INSERT w/o variable names for a SERIAL type?
От | Emils Klotins |
---|---|
Тема | INSERT w/o variable names for a SERIAL type? |
Дата | |
Msg-id | 200002251428.QAA06635@www.usis.bkc.lv обсуждение исходный текст |
Ответы |
Re: [SQL] INSERT w/o variable names for a SERIAL type?
|
Список | pgsql-sql |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello. I am using, which is written for connecting to another server and uses the AUTO_INCREMENT and BLOB fields (for storing text). Apparently it was written for mysql(?). I wanted to write a #define or two to change the relevant places, such as #define IDKEY "INTEGER AUTO_INCREMENT PRIMARY KEY" // mysql version #define IDKEY "SERIAL PRIMARY KEY" // postgres and currently stumbled upon mysql version of inserting the autoincrement value: NULL ie. CREATE TABLE mytable (id SERIAL PRIMARY KEY, textfield text); the mysql variant for inserting a row would be: INSERT INTO mytable VALUES (NULL, 'textvalue'); and NULL would get translated into the real value. Now, if I want to write a general #define, I'd need to have a way to specify 'default' for SERIAL field, for, if I omit the id field in VALUES, I need to specify all the rest of the fields explicitly. Is there any value I could put in place of id in VALUES part, to make it replaced with the next value in sequence? Emils -----BEGIN PGP SIGNATURE----- Version: PGP 6.5.2 -- QDPGP 2.61a Comment: http://community.wow.net/grt/qdpgp.html iQA/AwUBOLZuld0sxa1MAPWHEQJtVACg3Nsd7YiH3q2aXkIMSM/mjaLD3fgAn0bu S4NHXOsVsS26nntkkInqxBJw =HodA -----END PGP SIGNATURE-----
В списке pgsql-sql по дате отправления: