Solved

Simulate an update query in Postgres

Posted on 2007-11-16
4
1,111 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
ID: 20300451
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
ID: 20300623
select count(*) from your_table
where (your-update-where-clause-here)
0
 
LVL 61

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Getting certain data from a string 1 34
Access Date Query 28 44
Alter an update query which rounds 7 32
Join multiple pivot queries 2 8
Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
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.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

920 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

17 Experts available now in Live!

Get 1:1 Help Now