From: | Hannu Krosing <hannu(at)tm(dot)ee> |
---|---|
To: | Shra <shravan(at)yaskatech(dot)com> |
Cc: | Hannu Krosing <hannu(at)krosing(dot)net>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: MetaData (size of datatype) |
Date: | 2002-04-29 13:54:01 |
Message-ID: | 1020088441.27494.10.camel@taru.tm.ee |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-committers pgsql-hackers |
On Mon, 2002-04-29 at 13:16, Shra wrote:
> Hi Hannu,
>
> > -1 is given for types that are of fixed size and whose length can be
> > read from pg_type.typlen for that type.
>
> I don't think so...jsut look into this file pq_type.h.... it says.........
> *****************************************************************
> typlen is the number of bytes we use to represent a value of this type, e.g.
> 4 for an int4. But for a variable length type, typlen is -1
> *****************************************************************
>
> -1 is for variable length n not for fixed length.........this point is very
> clear even in documentation..........
Yes, it in pg_type.typlen it is -1 is for variable length and actual
length for fixed-length types
in pg_attribute.attypmod it is -1 for _fixed_ length types and actual
length for variable length types (actual length = defined length + 4
bytes of length bytes)
> now how to find length for a numeric, varchar or anyother one that has
> variable length where the system PQfsize returns -1.........?
>
> As tom said.....The type is encoded in the atttypmod field (see PQfmod) and
> recommended using format_type().....
> but when this is used, it returns -1 for integer , real n other fixed
> datatypes .........
so do as Tom said -
if
PQfsize returns -1
then
use PQfmod
else
use PQfsize
-----------
Hannu
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-04-29 14:39:34 | Re: MetaData (size of datatype) |
Previous Message | Shra | 2002-04-29 11:16:34 | Re: MetaData (size of datatype) |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-04-29 14:39:34 | Re: MetaData (size of datatype) |
Previous Message | Shra | 2002-04-29 11:16:34 | Re: MetaData (size of datatype) |
From | Date | Subject | |
---|---|---|---|
Next Message | Joel Burton | 2002-04-29 14:08:20 | pg_config Makefile includes hyphens in configure arguments |
Previous Message | Shra | 2002-04-29 11:16:34 | Re: MetaData (size of datatype) |