Re: Pear DB LastInsertID
| From: | shaggy at vip dot bg | Date: | Sun, 14 Jul 2002 12:50:53 +0000 |
| Subject: | Re: Pear DB LastInsertID | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-1878@lists.php.net to get a copy of this message | ||
> ----- Original Message ----
> From: Jonas Koch Bentzen <test@understroem.dk>
> To: pear-general@lists.php.net
> Sent: Fri, 12 Jul 2002 11:35:22 +0200
> Subject: Re: [PEAR] Pear DB LastInsertID
>
> Martin Tsachev skrev:
> >
> > Is it an advantage when you want to use something like MySQL's
> > auto_increment/PostgreSQL's SERIAL (PostgreSQL also supports sequences
> > though).
>
> It sounds like you believe that SERIAL is like MySQL's auto_increment,
> and the alternative is to use sequences. It's not like that.
> PostgreSQL's SERIAL uses sequences - it's not the same as MySQL's
> auto_increment. When you specify SERIAL for a column, the following
> things happen:
>
> - A sequence named tablename_seq is created (that is, a separate table
> for the sequence is made).
> - The column data type becomes INTEGER.
> - A primary key (NOT NULL + UNIQUE) is made for the column.
>
I'm pretty aware of the things that happen behind scences but it is integrated into PostgreSQL
and with MySQL it's not - it is emulated. So if I want to insert rows in a table that uses PEAR
sequences I'll either have to do it via PEAR or I have to manually update the so called
sequences.
Anyway I use PEAR sequences but I don't like the fact that it creates a separate table in MySQL
for every sequence, yes I know that MySQL doesn't have row locking.