Re: PostgresQL equivalent of NOCOUNT

Поиск
Список
Период
Сортировка
От Jochem van Dieten
Тема Re: PostgresQL equivalent of NOCOUNT
Дата
Msg-id 3B794FCD.1020703@oli.tudelft.nl
обсуждение исходный текст
Ответ на PostgresQL equivalent of NOCOUNT  (Jochem van Dieten <jochemd@oli.tudelft.nl>)
Ответы Re: PostgresQL equivalent of NOCOUNT  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane wrote:

> Jochem van Dieten <jochemd@oli.tudelft.nl> writes:
>
>>Does PostgresQL have some way to make update, insert and delete queries
>>not return the number of affected rows? I know that in MS SQL one would
>>use NOCOUNT for that.
>>
>
> Uh ... why?  Seems like a useless anti-feature.  Certainly suppressing
> the count wouldn't save a noticeable number of cycles.


I am not in it for the cycles, just for the laziness ;)
Currently working with a ColdFusion frontend through ODBC, and
ColdFusion is unable to return 2 resultsets for one call to cfquery (the
ColdFusion query implementation). In MS SQL I would use the query below
to suppress one resultset and return the primary key of the recently
inserted record.

SET NOCOUNT ON
  INSERT INTO ()
  VALUES ()
  SELECT @@IDENTITY AS 'Identity'
SET NOCOUNT OFF

I was wondering if something like that is possible in PostgresQL. I know
I can wrap it in a transaction and do a second query or build a
procedure to do it, but this would be much easier (presuming I can use
curval('primary_key_seq') instead of @@identity).

Any suggestions?

Jochem


В списке pgsql-general по дате отправления:

Предыдущее
От: Wieger Uffink
Дата:
Сообщение: nextval, sequences and sequencenames
Следующее
От: Tom Lane
Дата:
Сообщение: Re: PostgresQL equivalent of NOCOUNT