From: | "rob" <rob(at)cabrion(dot)com> |
---|---|
To: | "Florent Guillaume" <efgeor(at)noos(dot)fr>, "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Re: is PG able to handle a >500 GB Database? |
Date: | 2001-01-20 08:22:54 |
Message-ID: | 003301c082ba$3091bfc0$4100fd0a@cabrion.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
currval returns error unless nextval has been called at least once in the
session.
I use <seq>.last_value
Perhaps I'm fooling myself that the latter is doing what I think, but it
seems to work fine and doesn't require an initial call to nextval.
I too thought that OID was always unique. That is not true?
--rob
----- Original Message -----
From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: "Florent Guillaume" <efgeor(at)noos(dot)fr>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Friday, January 19, 2001 5:27 PM
Subject: Re: Re: is PG able to handle a >500 GB Database?
> Florent Guillaume wrote:
> >> Unless your application logic tries to use OIDs as row identifiers,
> >> duplicate OIDs in user tables are not a problem.
> >
> >Hmmm, that means that the following, which I use, is not strictly
correct :
> >
> >create table t1 (recordid SERIAL PRIMARY KEY, val INT4, name TEXT);
> >... much later ...
> >insert into t1 (val, name) values (3465, 'blah');
> >-- PHP application gets $lastoid for this insert
> >select recordid from t1 where oid = $lastoid;
> >-- PHP application now hast the recordid that was created.
> >
> >Because the last select could return several lines.
> >
> >What would be the correct idiom ? Explicitly use nextval ? That pretty
> >defeats the point of SERIAL, no ?
>
> SELECT currval('t1_recordid_seq');
>
> currval is guaranteed to return the value that the sequence has just put
> into recordid.
>
> --
> Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
> Isle of Wight http://www.lfix.co.uk/oliver
> PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
> GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
> ========================================
> "The LORD is my strength and song, and he is become my
> salvation; he is my God, and I will prepare him an
> habitation; my father's God, and I will exalt him."
> Exodus 15:2
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Emmanuel Charpentier | 2001-01-20 09:00:41 | Re: Re: couple of general questions |
Previous Message | rob | 2001-01-20 08:16:34 | Re: Re: MS Access data to PostgrSQL data |