Re: Nocount and scope_identity()
От | Andrew Sullivan |
---|---|
Тема | Re: Nocount and scope_identity() |
Дата | |
Msg-id | 20070202195729.GJ11505@phlogiston.dyndns.org обсуждение исходный текст |
Ответ на | Re: Nocount and scope_identity() ("Demel, Jeff" <Jeff.Demel@JavelinDirect.com>) |
Ответы |
Re: Nocount and scope_identity()
|
Список | pgsql-sql |
On Fri, Feb 02, 2007 at 01:38:40PM -0600, Demel, Jeff wrote: > Not as far as I know. What's it supposed to do? > > It suppresses the rowcount returned after the query runs. There isn't a way to do that, although there is a way in psql, for example, not to get all that formatting. You want the \pset commands. The count isn't automatically delivered with most APIs (i.e. if you want to know how many rows you touched, you usually have to ask explicitly). > > SCOPE_IDENTITY() method is going to work or not. > I doubt it. What does it do? > > It returns the id of the record just inserted. Ah. Well, there's no in-principle notion if "id" in Postgres (OIDs are optional as of several versions ago). But if you have a primary key that's an integer you populate using a sequence, then you can use the currval() function to get the value of the sequence. There's no race condition there unless you are sharing a pooled connection (and if transactions mean anything to you, you'd better not be doing). A -- Andrew Sullivan | ajs@crankycanuck.ca The fact that technology doesn't work is no bar to success in the marketplace. --Philip Greenspun
В списке pgsql-sql по дате отправления: