Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 6F1159FB673 for ; Sun, 11 Mar 2007 13:54:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 70266-05-3 for ; Sun, 11 Mar 2007 13:54:30 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id CD0819FB789 for ; Sun, 11 Mar 2007 13:54:30 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HQRJM-0007kv-IR for pgadmin-support@postgresql.org; Sun, 11 Mar 2007 17:54:22 +0100 Received: from 85.187.136.11 ([85.187.136.11]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 Mar 2007 17:54:20 +0100 Received: from milen by 85.187.136.11 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 Mar 2007 17:54:20 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgadmin-support@postgresql.org From: "Milen A. Radev" Subject: Re: Alternative Serial Date: Sun, 11 Mar 2007 18:54:32 +0200 Lines: 40 Message-ID: References: <55c095e90703110720o78dfcfeai2b31bbadf17582b7@mail.gmail.com> <55c095e90703110808u567e9a1dr4d038b2b382b3a68@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 85.187.136.11 User-Agent: Mozilla Thunderbird 1.5.0.10 (Windows/20070221) In-Reply-To: <55c095e90703110808u567e9a1dr4d038b2b382b3a68@mail.gmail.com> Cc: pgsql-sql@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.091 tagged_above=0 required=5 tests=AWL, BAYES_50, RCVD_NUMERIC_HELO, SPF_HELO_PASS, SPF_PASS X-Spam-Level: * X-Archive-Number: 200703/44 X-Sequence-Number: 6759 Ezequias Rodrigues da Rocha написа: > Yes you are right, I means sequences. > Please re-read my reply! > The second way is better for me that have Id (PK) fields not defined as > Sequences. Now it is much more difficult to change the type of my PK than A field could not be defined as 'sequence', but as 'serial', because 'sequence' is a db object and 'serial' is a (pseudo-)type. The actual type of a field defined as 'serial' is 'integer' (or 'bigint' in case of 'bigserial'). You could change the type of a field (defined as sequence earlier) as easy as you could any other field. Or you could just change its default value. Or anything else. > define a Default value. I am just concerned about the consistency of this > sequence. Could you make me more easy ? What do you mean by 'consistency' here? Guaranteed uniqueness of the numbers generated by the sequence? Pleas read the fine documentation here - http://www.postgresql.org/docs/8.2/static/sql-createsequence.html. > > And about the cast I have found ? > > nextval('mySerial_id'::regclass) > > I ask again. What is regclass ? What does it really is. I already answered that one, please re-read my reply and the pages it mentions. [...] -- Milen A. Radev