Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1181
  • Last Modified:

Simulate an update query in Postgres

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
mock5c
Asked:
mock5c
2 Solutions
 
pmctrekCommented:
Not sure if this will work raw or you may need pl\PgSQL installed on the database.

BEGIN
  UPDATE .....
ROLLBACK
0
 
sdstuberCommented:
select count(*) from your_table
where (your-update-where-clause-here)
0
 
gheistCommented:
rewrite your update into SELECT:
select count(*) from ... where ...
0
 
earth man2Commented:
use transaction control and rollback your changes.
begin work;
update xxx...
rollback work;
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now