Re: MetaData (size of datatype)

From: Shra <shravan(at)yaskatech(dot)com>
To: Hannu Krosing <hannu(at)krosing(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: MetaData (size of datatype)
Date: 2002-04-29 11:16:34
Message-ID: f0204291714560232@yaskatech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-committers pgsql-hackers

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..........

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 .........

any better way , please.........

Shra

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Hannu Krosing 2002-04-29 13:54:01 Re: MetaData (size of datatype)
Previous Message Ram 2002-04-29 06:31:56 Problem

Browse pgsql-committers by date

  From Date Subject
Next Message Hannu Krosing 2002-04-29 13:54:01 Re: MetaData (size of datatype)
Previous Message Shra 2002-04-29 06:20:25 MetaData (size of datatype)

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2002-04-29 13:54:01 Re: MetaData (size of datatype)
Previous Message Francois Suter 2002-04-29 08:46:49 Re: pid gets overwritten in OSX