From: Emils Klotins <emils@mail.usis.bkc.lv>
To: pgsql-sql@postgreSQL.org
Subject: INSERT w/o variable names for a SERIAL type?
Date: Fri, 25 Feb 2000 15:59:40 +0200
Message-ID: <200002251428.QAA06635@www.usis.bkc.lv> (raw)
-----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-----
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: emils@mail.usis.bkc.lv
Subject: Re: INSERT w/o variable names for a SERIAL type?
In-Reply-To: <200002251428.QAA06635@www.usis.bkc.lv>
References: <200002251428.QAA06635@www.usis.bkc.lv>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox