pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: terry@greatgulfhomes.com
To: Postgres (E-mail) <pgsql-docs@postgresql.org>
Subject: Make update query appear as a select
Date: Mon, 17 Jun 2002 10:33:11 -0400
Message-ID: <003f01c2160b$e8ae8d00$2766f30a@development.greatgulfhomes.com> (raw)

I need to do either an update, or insert.  Rather then get a lock, get a
recordcount, and then perform an UPDATE/INSERT based on the result of my
count, I was hoping to just do the update, and if nothing happened then I
know I need to do an insert...

So, the application is written in ColdFusion, and someone suggested doing
this:
<cfquery name="update_recent"
datasource="#variables.local_datasource_name#">
	UPDATE user_recent_list
	SET    access_stamp = now()
	WHERE   user_id = '#variables.local_user_id#'
		AND app_name = '#variables.local_app_name#';
	SELECT @@rowcount as rows_updated;
</cfquery>

But this part:
	SELECT @@rowcount as rows_updated;
Does not work on Postgres.  Does anyone know what the equivalent statement
is for Postgres?

Thanks


Terry Fielder
Network Engineer
Great Gulf Homes / Ashton Woods Homes
terry@greatgulfhomes.com




Message-ID: <003f01c2160b$e8ae8d00$2766f30a@development.greatgulfhomes.com>
Permalink:  ../003f01c2160b$e8ae8d00$2766f30a@development.greatgulfhomes.com/
Also on:    postgresql.org/message-id/003f01c2160b$e8ae8d00$2766f30a@development.greatgulfhomes.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: terry@greatgulfhomes.com
  Subject: Re: Make update query appear as a select
  In-Reply-To: <003f01c2160b$e8ae8d00$2766f30a@development.greatgulfhomes.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox