Re: A couple of newbie questions ...
| От | A. Kretschmer |
|---|---|
| Тема | Re: A couple of newbie questions ... |
| Дата | |
| Msg-id | 20080723101655.GD28492@a-kretschmer.de обсуждение |
| Ответ на | A couple of newbie questions ... (admin <mick@mjhall.org>) |
| Список | pgsql-general |
am Wed, dem 23.07.2008, um 19:18:15 +0930 mailte admin folgendes:
> 1. Is a SEQUENCE what I use instead of auto_increment?
Yes.
>
> 2. Does this work in PostgreSQL:
>
> INSERT INTO table VALUES ('x','y','z')
>
> or do I need to do this
>
> INSERT INTO table (fld_x,fld_y,fld_z) VALUES ('x','y','z')
Both worked, but it is better to list the columns. If you change later
the table-design, the first (without column-list) insert fails.
>
> ?
>
> 3. Does this work in PostgreSQL:
>
> INSERT INTO table VALUES ('','y','z')
>
> where the empty first item is intended for an auto_increment/SEQUENCE id
> field?
> If not, what is an alternative?
Use 'default' instead (without the ') or omit this column in the
column-list.
HTH, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
В списке pgsql-general по дате отправления: