Re: column size in libpq

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Piotr Filipczuk <filip(at)oeiizk(dot)waw(dot)pl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: column size in libpq
Date: 2005-04-25 19:48:33
Message-ID: 01CEA15F-B5C3-11D9-B125-000A95B03262@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Apr 25, 2005, at 4:53 AM, Piotr Filipczuk wrote:

> How to determinate column size in query in libpq? Especially when
> column is declared for exapmle as varchar(64). PQfsize return -1
> which mean that is variable and PQfmod returns 68.

68 - 4 is the correct size for varchar(64). There is 4 bytes of
overhead included in the return value.

If you are trying to do something like column formatting where you need
to know the longest length, maybe take a look at the psql source and
see how it works there.

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2005-04-25 19:59:46 Re: plpgsql function not working
Previous Message Ruff, Jeffry C. SR. 2005-04-25 19:40:29 plpgsql function not working