Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Simulate an update query in Postgres

Posted on 2007-11-16
4
Medium Priority
?
1,169 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 100 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 100 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

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

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

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
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.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

688 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