Solved

Simulate an update query in Postgres

Posted on 2007-11-16
4
1,106 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
4 Comments
 
LVL 3

Accepted Solution

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

BEGIN
  UPDATE .....
ROLLBACK
0
 
LVL 73

Assisted Solution

by:sdstuber
sdstuber earned 25 total points
Comment Utility
select count(*) from your_table
where (your-update-where-clause-here)
0
 
LVL 61

Expert Comment

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

Expert Comment

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Access  query that references subform for criteria 12 49
Not Like IN Access Query not Working 10 59
query Syntax 4 32
mySql Syntax 7 26
In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now