| From: | Louise Catherine <r1c4n(at)yahoo(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Field length ?? |
| Date: | 2006-04-20 06:08:38 |
| Message-ID: | 20060420060838.46274.qmail@web33403.mail.mud.yahoo.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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! Messengers low PC-to-Phone call rates.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mariya Yuniarti | 2006-04-20 07:37:08 | ask syntax sql to get length of field |
| Previous Message | Josh Berkus | 2006-04-20 04:31:45 | Re: Programatically Backup Database Using Visual Basic |