On Thu, Jul 07, 2005 at 14:47:23 -0600,
Larry Meadors [EMAIL PROTECTED] wrote:
If you have a trigger on your table that inserts a record in a table
and shares the same sequence, what value do you get back, the
triggered curval, or the currently inserted one?
Whichever one was done second. I
On Jul 7, 2005, at 4:14 PM, Theodore Petrosky wrote:
you have to use currval inside a transaction...
begin;
insert something that increments the counter;
select currval('sequence_name');
end;
using currval inside a transaction guarantees that the
value is correct for your insert statement
Sounds like M$ SuckQL's @@identity value. ;-)
Larry
On 7/7/05, Michael Fuhr [EMAIL PROTECTED] wrote:
On Fri, Jul 08, 2005 at 01:56:26AM +0200, PFC wrote:
Do you mean with lastval()? Here's what happens:
Hm, interesting, you mean the return value of lastval() also depends
if you set
If you have a trigger on your table that inserts a record in a table
and shares the same sequence, what value do you get back, the
triggered curval, or the currently inserted one?
Being a lazy bum, this is why I still prefer the get key - insert
record approach. Less brain power required. ;-)
:03 PM
Subject: Re: [SQL] getting back autonumber just inserted
On Thu, Jul 07, 2005 at 07:50:16PM +0200, mail TechEvolution wrote:
hello
i ame a newbie to PostGreSQL, I ame using PostGreSQL 8.0
(windowsinstaller) on a xp prof platform
i would like to get back the autonumber from
Quoting jimmy.olsen [EMAIL PROTECTED]:
I don't know how to create a Global Variable in Postgres, but the
idea is
very simple:
1. Encapsulate the NextVal function in MyNextVal
2. Set to Global variable with NextVal of the desired sequence
3. Inspect to value of the global variable (exactally
On Fri, Jul 08, 2005 at 05:03:37 +0200,
PFC [EMAIL PROTECTED] wrote:
It's the first time I see a MySQLism in postgres !
This has meaning in more ways than one.
However I like it, cos it might subvert some MySQL users, and
provide easy answers to The Weekly Question on
hello
i ame a newbie to PostGreSQL, I ame using PostGreSQL 8.0
(windowsinstaller) on a xp prof platform
i would like to get back the autonumber from the last record inserted,
for other SQL db (m$ sql db ...) i could use:
SELECT @@ IDENTITY
can someone help me by informing me what the SQL
On Thu, Jul 07, 2005 at 07:50:16PM +0200, mail TechEvolution wrote:
hello
i ame a newbie to PostGreSQL, I ame using PostGreSQL 8.0
(windowsinstaller) on a xp prof platform
i would like to get back the autonumber from the last record inserted,
for other SQL db (m$ sql db ...) i could
you have to use currval inside a transaction...
begin;
insert something that increments the counter;
select currval('sequence_name');
end;
using currval inside a transaction guarantees that the
value is correct for your insert statement and has not
changed by another insert statement.
Ted
On Thu, 2005-07-07 at 15:14, Theodore Petrosky wrote:
you have to use currval inside a transaction...
begin;
insert something that increments the counter;
select currval('sequence_name');
end;
using currval inside a transaction guarantees that the
value is correct for your insert
On Thu, Jul 07, 2005 at 01:14:33PM -0700, Theodore Petrosky wrote:
you have to use currval inside a transaction...
Not true. Have you observed otherwise?
begin;
insert something that increments the counter;
select currval('sequence_name');
end;
using currval inside a transaction
On Thu, Jul 07, 2005 at 02:47:23PM -0600, Larry Meadors wrote:
If you have a trigger on your table that inserts a record in a table
and shares the same sequence, what value do you get back, the
triggered curval, or the currently inserted one?
That's a different issue than whether currval() is
That's a different issue than whether currval() is subject to
interference from other transactions. And just wait until PostgreSQL
8.1 comes out and people start using lastval() -- then it could get
*really* confusing which sequence value you're getting.
What happens if an INSERT trigger
On Fri, Jul 08, 2005 at 12:26:30AM +0200, PFC wrote:
That's a different issue than whether currval() is subject to
interference from other transactions. And just wait until PostgreSQL
8.1 comes out and people start using lastval() -- then it could get
*really* confusing which sequence value
On Fri, Jul 08, 2005 at 12:26:30AM +0200, PFC wrote:
That's a different issue than whether currval() is subject to
interference from other transactions. And just wait until PostgreSQL
8.1 comes out and people start using lastval() -- then it could get
*really* confusing which sequence value
Do you mean with lastval()? Here's what happens:
Hm, interesting, you mean the return value of lastval() also depends if
you set your constraints to deferred or immediate ?
I wond
---(end of broadcast)---
TIP 6: Have you searched our
What happens if an INSERT trigger inserts something into another
table which also has a sequence ?
Using what, lastval()? The app will get very confused, because it'll
get the value from the sequence used in the trigger. Using currval
there is no problem, but you already
On Fri, Jul 08, 2005 at 01:56:26AM +0200, PFC wrote:
Do you mean with lastval()? Here's what happens:
Hm, interesting, you mean the return value of lastval() also depends
if you set your constraints to deferred or immediate ?
My mind's ablank trying to contrive a situation where that
On Fri, Jul 08, 2005 at 05:03:37AM +0200, PFC wrote:
On Fri, Jul 08, 2005 at 01:56:26AM +0200, PFC wrote:
Hm, interesting, you mean the return value of lastval() also depends
if you set your constraints to deferred or immediate ?
My mind's ablank trying to contrive a situation where that
: [SQL] getting
back autonumber just inserted
[EMAIL PROTECTED]
tgresql.org
I don't work with M$ DBs, but saw that autonumber is an M$ concept.
Purely for my own edification, how do you get the most resent
value of an autonumber in M$? I was helping someone out who
was using M$ stuff and was amazed that there was no currval function.
I beleive they call it
On Thu, 2005-02-03 at 16:16, lorid wrote:
I could have sworn I kept a copy of prior emails that discussed how to
get back a value that was just inserted into a autonumber (or in
postgresql case a sequence number)
If you know the name of the sequence the number came from you can use
On Feb 3, 2005, at 5:16 PM, lorid wrote:
I could have sworn I kept a copy of prior emails that discussed how to
get back a value that was just inserted into a autonumber (or in
postgresql case a sequence number)
See here:
http://www.postgresql.org/docs/8.0/interactive/functions-
Perhaps you meant:
http://www.postgresql.org/docs/8.0/interactive/functions-info.html#FUNCTIONS-INFO-SCHEMA-TABLE
in particular |pg_get_serial_sequence|(table_name, column_name)
Sean Davis wrote:
On Feb 3, 2005, at 5:16 PM, lorid wrote:
I could have sworn I kept a copy of prior emails that
25 matches
Mail list logo