Jeff Eckermann <[EMAIL PROTECTED]> writes:
> --- Jerry III <[EMAIL PROTECTED]> wrote:
>> Which means that sometimes they do not return the
>> correct value - if you
>> have a trigger that inserts another record you will
>> not get the right value.
> If you are new to PostgreSQL, as you say, then
On Tue, 16 Nov 2004, Jeff Eckermann wrote:
> --- Jerry III <[EMAIL PROTECTED]> wrote:
>
> > Which means that sometimes they do not return the
> > correct value - if you
> > have a trigger that inserts another record you will
> > not get the right value.
>
> If you are new to PostgreSQL, as you sa
--- Jerry III <[EMAIL PROTECTED]> wrote:
> Which means that sometimes they do not return the
> correct value - if you
> have a trigger that inserts another record you will
> not get the right value.
If you are new to PostgreSQL, as you say, then why are
you so sure of this? Perhaps you may pro
Which means that sometimes they do not return the correct value - if you
have a trigger that inserts another record you will not get the right value.
MSSQL has @@IDENTITY and SCOPE_IDENTITY() to handle this case, I'm new to
pgsql so I don't know if it has anything like that.
Jerry
"Richard Hux
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Thursday 11 November 2004 10:23 am, Franco Bruno Borghesi wrote:
> I think the best way would be not to use a SERIAL field, but an INTEGER
> field and a sequence:
a "serial" is just a convenient shortcut to an int with an automatically
created seq
MaRCeLO PeReiRA wrote:
How can I now (for sure) with value was generated by
the sequence to fill the field ID?
(There is lots of users using the software at the same
time, so I am not able to use the last_value()
function on the sequence.)
Yes you are nextval()/currval() are multi-user safe. They r
On Thu, Nov 11, 2004 at 09:59:16 -0300,
MaRCeLO PeReiRA <[EMAIL PROTECTED]> wrote:
>
> Well, once I do an INSERT in the parent table, how can
> I know (for sure) which number id was generated by the
> sequence?
Use currval.
---(end of broadcast)-
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
option 1) use a stored procedure to create the record. Within a transaction
the last value function will return the correct last value, not the one of a
concurrent insert.
option 2) if you know that this user uses the same connection for all his
qu
On Thu, 2004-11-11 at 09:59 -0300, MaRCeLO PeReiRA wrote:
> Hi guys,
>
> I am in troubles with a SERIAL field.
>
> I have five tables. A parent table and four child
> tables. When I do the INSERT in the parent table, I
> have an ID (generated) by the sequence (SERIAL field),
> and I have to use t
I think the best way would be not to use a SERIAL field, but an INTEGER
field and a sequence:
CREATE SEQUENCE parent_seq;
CREATE TABLE parent(id INTEGER, descrip CHAR(50));
So when you want to insert on the parent table, you obtain the next
value from the sequence and then you insert in the pare
10 matches
Mail list logo