Solved

Simulate an update query in Postgres

Posted on 2007-11-16
4
1,143 Views
Last Modified: 2012-08-13
Is there a way I can simulate an update query so it will tell me a certain of number of rows would be updated but doesn't actually update them?
0
Comment
Question by:mock5c
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 3

Accepted Solution

by:
pmctrek earned 25 total points
ID: 20300451
Not sure if this will work raw or you may need pl\PgSQL installed on the database.

BEGIN
  UPDATE .....
ROLLBACK
0
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 25 total points
ID: 20300623
select count(*) from your_table
where (your-update-where-clause-here)
0
 
LVL 62

Expert Comment

by:gheist
ID: 20300741
rewrite your update into SELECT:
select count(*) from ... where ...
0
 
LVL 22

Expert Comment

by:earth man2
ID: 20304166
use transaction control and rollback your changes.
begin work;
update xxx...
rollback work;
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question