Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 0C2809FA1DB for ; Mon, 13 Nov 2006 11:03:59 -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 91531-10 for ; Mon, 13 Nov 2006 15:03:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web35303.mail.mud.yahoo.com (web35303.mail.mud.yahoo.com [66.163.179.97]) by postgresql.org (Postfix) with SMTP id 7806E9FA18A for ; Mon, 13 Nov 2006 11:03:54 -0400 (AST) Received: (qmail 91897 invoked by uid 60001); 13 Nov 2006 15:03:52 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:MIME-Version:Content-Type; b=GF6yWQv8mrZ6rVGAL+nscfPu68nnW3nfrQ13/d7waBgi+leFSToKOQyx8UiraoyOVpnn8OCy1tYZYfH2E4WbC43y8D1PIarc9sJDyBZkL2IC2Xku/i3czn8qlzxNLmi7oyCdHsVthqAvN6LzTanh7G6Tvq7O0khVU2NQoC3ej0s= ; Message-ID: <20061113150352.91895.qmail@web35303.mail.mud.yahoo.com> Received: from [74.98.189.48] by web35303.mail.mud.yahoo.com via HTTP; Mon, 13 Nov 2006 07:03:52 PST Date: Mon, 13 Nov 2006 07:03:52 -0800 (PST) From: Jean-Christophe Roux Subject: Re: get column default value To: Ketema Harris Cc: pgsql-php@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1962304549-1163430232=:91732" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.891 tagged_above=0 required=5 tests=BAYES_00, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS, HTML_50_60, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200611/43 X-Sequence-Number: 3660 --0-1962304549-1163430232=:91732 Content-Type: text/plain; charset=ascii Content-Transfer-Encoding: quoted-printable I understand that but I need to build an interface so that my user can chan= ge the default values of some table/columns. So I need a way to query the c= urrent default value to show the user what it is currently. For instance, l= et's say I have a table products and there is a column price and the defaul= t price is $199, I'd like to get that $199 and give my user the opportunity= to update that value. The column does not have any sequence attached to it= .=0AJCR=0A=0A----- Original Message ----=0AFrom: Ketema Harris =0ATo: Jean-Christophe Roux =0ACc: pgsql-php@postgre= sql.org=0ASent: Monday, November 13, 2006 9:59:29 AM=0ASubject: Re: [PHP] g= et column default value=0A=0AThe default value for a column is just that th= e value you say is default. It only come into play when you do an insert i= nto the table. If you do not provide a value for that column then your def= ault value is entered.=0A=0ANow 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 documente= d in the pg manual.=0A=0AOn Nov 13, 2006, at 9:49 AM, Jean-Christophe Roux = wrote:=0A=0AHello,=0AHow can I get the default value for a column?=0ATo cha= nge the default value, something like=0AALTER TABLE dummy ALTER COLUMN valu= e SET DEFAULT -12;=0Awould do the job, but how could I query the value?=0A= =0A=0AThanks in advance=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A --0-1962304549-1163430232=:91732 Content-Type: text/html; charset=ascii Content-Transfer-Encoding: quoted-printable
I understand that but I need to build an interface = so that my user can change the default values of some table/columns. So I n= eed a way to query the current default value to show the user what it is cu= rrently. For instance, let's say I have a table products and there is a col= umn price and the default price is $199, I'd like to get that $199 and give= my user the opportunity to update that value. The column does not have any= sequence attached to it.
JCR

----- Original Message ----=
From: Ketema Harris <ketema@gmail.com>
To: Jean-Christophe Rou= x <jcxxr@yahoo.com>
Cc: pgsql-php@postgresql.org
Sent: Monday, = November 13, 2006 9:59:29 AM
Subject: Re: [PHP] get column default value

The defau= lt value for a column is just that the value you say is default.  It o= nly come into play when you do an insert into the table.  If you do no= t provide a value for that column then your default value is entered.
<= br class=3D"khtml-block-placeholder">
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 thei= r functions are documented in the pg manual.

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

<= div style=3D"font-family: times new roman; font-size: 16px;">Hello,
= How can I get the default value for a column?
To chan= ge 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

=



--0-1962304549-1163430232=:91732--