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
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. ;-)
L
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
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 an
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 (
TECTED]>
Cc:
Sent: Thursday, July 07, 2005 3: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
> > (windows
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 Questio
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 w
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 wou
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
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 kne
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 list
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 sequen
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 sequen
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 ins
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()
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 transactio
THX to all guys, it is working great !!
greetZ
wes
---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
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 inser
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, Jul 07, 2005 at 08:21:12PM +0200, mail TechEvolution wrote:
> hi Alvaro Herrera
>
> >>You use the currval() function, using the name of the involved sequence
> >>as parameter. There is a pg_get_serial_sequence() function, to which
> >>you give the table name and column name
>
> thx for t
hi Alvaro Herrera
You use the currval() function, using the name of the involved sequence
as parameter. There is a pg_get_serial_sequence() function, to which
you give the table name and column name
thx for the information
and is there a function i can use to get the last added autonumber wi
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 cou
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 sy
> 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 ID
: Subject: Re: [SQL] getting
back autonumber just inserted
[EMAIL PROTECTED]
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 discus
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-
sequence.html
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
currva
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)
any help will be appreciated
thanks
Lori
---(end of broadcast)---
TIP 5: Hav
30 matches
Mail list logo