X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx2.hub.org [200.46.204.254]) by postgresql.org (Postfix) with ESMTP id 7347511F8CD4 for ; Thu, 20 Apr 2006 03:08:47 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 1.555 X-Spam-Level: * X-Spam-Status: No, score=1.555 required=5 tests=[AWL=0.351, BAYES_00=-2.599, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_WHOIS=1.447, FROM_HAS_MIXED_NUMS=2.155, HTML_MESSAGE=0.001] Received: from postgresql.org ([200.46.204.71]) by localhost (mx2.hub.org [200.46.204.254]) (amavisd-new, port 10024) with ESMTP id FaV8waHUSEsI for ; Thu, 20 Apr 2006 03:08:39 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web33403.mail.mud.yahoo.com (web33403.mail.mud.yahoo.com [68.142.206.135]) by postgresql.org (Postfix) with SMTP id E070C11F8CC7 for ; Thu, 20 Apr 2006 03:08:38 -0300 (ADT) Received: (qmail 46276 invoked by uid 60001); 20 Apr 2006 06:08:38 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=St9QaZX3/fMSaFlsnVKEA5VDegEV0eTnI79VlNs3KDAmGlRH+bVMDoQIRPAY8IrhDl0QZtHys/pzxvleR1S8q0Ec/pTRrTRbGcp2Wa9Ik1p/JQjwz1ZSUBPCCZmXcTG7jsIXrKffeByQqSU6spV5mLx4f8eP5lguR+PczNuMJAg= ; Message-ID: <20060420060838.46274.qmail@web33403.mail.mud.yahoo.com> Received: from [222.124.227.199] by web33403.mail.mud.yahoo.com via HTTP; Wed, 19 Apr 2006 23:08:38 PDT Date: Wed, 19 Apr 2006 23:08:38 -0700 (PDT) From: Louise Catherine Subject: Re: Field length ?? To: pgsql-sql@postgresql.org In-Reply-To: <20060420033202.50061.qmail@web33408.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-633594195-1145513318=:46248" Content-Transfer-Encoding: 8bit X-Archive-Number: 200604/133 X-Sequence-Number: 24942 --0-633594195-1145513318=:46248 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi , With this table : create table test( satu char(10), dua char(5) ); To get the field length, I use this query: select atttypmod from pg_attribute where attname='satu' and attrelid=(select oid from pg_class where relname='test'); ---> result 1 : 14 select atttypmod from pg_attribute where attname='dua' and attrelid=(select oid from pg_class where relname='test'); ---> result 2 : 9 Could anyone explain, why the field length must be add by 4 : result 1 : 10 + 4 =14 result 2 : 5 + 4 = 9 Could I use this query ? Is it valid? select atttypmod-4 from pg_attribute where attname='satu' and attrelid=(select oid from pg_class where relname='test'); Thank's, Rina --------------------------------- How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates. --0-633594195-1145513318=:46248 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi ,

With this table :
create table test(
satu char(10),
dua char(5)
);

To get the field length, I use this query:

select atttypmod from pg_attribute where
attname='satu' and
attrelid=(select oid from pg_class where relname='test');
---> result 1 : 14

select atttypmod from pg_attribute where
attname='dua' and
attrelid=(select oid from pg_class where relname='test');
---> result 2 : 9


Could anyone explain, why the field length must be add by 4 :
result 1 : 10 + 4 =14
result 2 : 5 + 4 = 9

Could I use this query ? Is it valid?
select atttypmod-4 from pg_attribute where
attname='satu' and
attrelid=(select oid from pg_class where relname='test');

Thank's,
Rina


How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates. --0-633594195-1145513318=:46248--