Received: from holmes.infopro.spb.su (holmes.infopro.spb.su [195.242.2.2]) by hub.org (8.9.3/8.9.3) with ESMTP id OAA73904 for ; Sat, 4 Dec 1999 14:23:49 -0500 (EST) (envelope-from avm@webclub.ru) Received: from barrymore.peterlink.ru (barrymore.peterlink.ru [195.242.2.8]) by holmes.infopro.spb.su (8.9.1/8.9.1) with ESMTP id WAA25641 for ; Sat, 4 Dec 1999 22:23:48 +0300 (MSK) Received: from 192.168.0.3 (spb-1-175.dialup.peterlink.ru [195.242.1.175]) by barrymore.peterlink.ru (8.9.1/8.9.1) with ESMTP id WAA00480 for ; Sat, 4 Dec 1999 22:23:46 +0300 (MSK) Date: Sat, 4 Dec 1999 22:23:24 +0300 From: "Alexey V. Meledin" X-Mailer: The Bat! (v1.36) S/N F29DEE5D / Educational Reply-To: "Alexey V. Meledin" Organization: InterForge Developers Group, Spb X-Priority: 3 (Normal) Message-ID: <7932.991204@webclub.ru> To: pgsql-sql@postgresql.org Subject: Two serial fields, PK identity Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! 1. apache=> create table tmp2 (a serial, b serial, name text); apache=> \ds Database = apache +------------------+----------------------------------+----------+ | Owner | Relation | Type | +------------------+----------------------------------+----------+ | apache | tmp2_b_seq | sequence | +------------------+----------------------------------+----------+ Where is tmp2_a_seq? Why there can't be two serial fields at all and parser doesn't say me about? 2. SERIAL type as PRIMARY KEY For example: apache=> create table tmp4 (a serial); NOTICE: CREATE TABLE will create implicit sequence 'tmp4_a_seq' for SERIAL column 'tmp4.a' NOTICE: CREATE TABLE/UNIQUE will create implicit index 'tmp4_a_key' for table 'tmp4' CREATE apache=> create table tmp5 (a serial primary key); NOTICE: CREATE TABLE will create implicit sequence 'tmp5_a_seq' for SERIAL column 'tmp5.a' NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'tmp5_pkey' for table 'tmp5' CREATE So, I thing, if I use SERIAL I can omit PRIMARY KEY constraint, but receive PK via SERIAL type. Then I must define trigger or rule on UPDATE to keep PK IDENTITY. Is it so? Regards, Alexey V. Meledin InterForge Developers Group, Saint-Petersburg look_to: >>>>>>>>>>>>>>>> mail_to: >>>