Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 0DB319FA18A for ; Mon, 13 Nov 2006 10:59:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 90227-09 for ; Mon, 13 Nov 2006 14:59:43 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.231]) by postgresql.org (Postfix) with ESMTP id EDDF09FA1DB for ; Mon, 13 Nov 2006 10:59:42 -0400 (AST) Received: by wx-out-0506.google.com with SMTP id i28so1191777wxd for ; Mon, 13 Nov 2006 06:59:41 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:from:subject:date:to:x-mailer; b=s3Q2eUklH9S65eZv63faepr/uEA/Yuue+QFt+/VunFk4UGuOyA5PP2Okz61xRl6o1wsDT+MoNLFtuSs7vdg+oiB23GBcsj6JyCLfOYB8mlQE8jkP7BtgHkL6odBK3K6rf0udSdper9o8BcOI0r/hIJnYIfbreWERCBPjEyqoHUY= Received: by 10.70.43.8 with SMTP id q8mr10010092wxq.1163429980503; Mon, 13 Nov 2006 06:59:40 -0800 (PST) Received: from ?192.168.0.12? ( [24.227.61.54]) by mx.google.com with ESMTP id h38sm10699512wxd.2006.11.13.06.59.39; Mon, 13 Nov 2006 06:59:39 -0800 (PST) In-Reply-To: <20061113144914.83394.qmail@web35307.mail.mud.yahoo.com> References: <20061113144914.83394.qmail@web35307.mail.mud.yahoo.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: multipart/alternative; boundary=Apple-Mail-70-439175372 Message-Id: <73E54DDE-B024-49FD-8247-739F9B73532A@gmail.com> Cc: pgsql-php@postgresql.org From: Ketema Harris Subject: Re: get column default value Date: Mon, 13 Nov 2006 09:59:29 -0500 To: Jean-Christophe Roux X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/42 X-Sequence-Number: 3659 --Apple-Mail-70-439175372 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed The default value for a column is just that the value you say is default. It only come into play when you do an insert into the table. If you do not provide a value for that column then your default value is entered. Now if you set the default value of a column to a sequence, then you can manage the sequence using the sequence functions: currval, nextval, and setval. Sequences and their functions are documented in the pg manual. On Nov 13, 2006, at 9:49 AM, Jean-Christophe Roux wrote: > Hello, > How can I get the default value for a column? > To change the default value, something like > ALTER TABLE dummy ALTER COLUMN value SET DEFAULT -12; > would do the job, but how could I query the value? > > > Thanks in advance > --Apple-Mail-70-439175372 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 The default value for a column = is just that the value you say is default.=A0 It only come into play = when you do an insert into the table.=A0 If you do not provide a value = for that column then your default value is entered.

Now if you set the default = value of a column to a sequence, then you can manage the sequence using = the sequence functions: currval, nextval, and setval.=A0 Sequences and = their functions are documented in the pg = manual.

On Nov 13, 2006, at 9:49 AM, = Jean-Christophe Roux wrote:

Hello,
How can I get = the default value for a column?
To change the = default value, something like
ALTER TABLE = dummy ALTER COLUMN value SET DEFAULT -12;
would do the = job, but how could I query the value?


Thanks in advance