Re: Selecting a constant question

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Dann Corbit" <DCorbit(at)connx(dot)com>, "Martijn van Oosterhout" <kleptog(at)svana(dot)org>
Cc: <pgsql-hackers(at)postgresql(dot)org>, "Larry McGhaw" <lmcghaw(at)connx(dot)com>
Subject: Re: Selecting a constant question
Date: 2007-06-11 21:08:12
Message-ID: D425483C2C5C9F49B5B7A41F8944154701000712@postal.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org [mailto:pgsql-hackers-
> owner(at)postgresql(dot)org] On Behalf Of Dann Corbit
> Sent: Monday, June 11, 2007 1:52 PM
> To: Martijn van Oosterhout
> Cc: pgsql-hackers(at)postgresql(dot)org
> Subject: Re: [HACKERS] Selecting a constant question
>
> > -----Original Message-----
> > From: Martijn van Oosterhout [mailto:kleptog(at)svana(dot)org]
> > Sent: Monday, June 11, 2007 1:46 PM
> > To: Dann Corbit
> > Subject: Re: [HACKERS] Selecting a constant question
> >
> > On Mon, Jun 11, 2007 at 01:29:37PM -0700, Dann Corbit wrote:
> > > Our application is using the libPQ interface to access postgres.
> > >
> > > The query is "select '123' from <tablename>" .. the table is not
> > > important.
> > >
> > > After executing the query, we interrogate the metadata of the
result
> set
> > > using the PQfsize, PQfmod and PQftype functions.
> >
> > Did you read the documentation of the PQfsize function?
> >
> > PQfsize returns the space allocated for this column in a database
row,
> > in other words the size of the server's internal representation of
the
> > data type. (Accordingly, it is not really very useful to clients.) A
> > negative value indicates the data type is variable-length.
> >
> >
>
http://www.postgresql.org/docs/8.2/interactive/libpq-exec.html#LIBPQ-EXE
> C-
> > SELECT-INFO
> >
> > > The size of the column is returned as 65534 (or -2 if you
consider
> this
> > > a signed short value)
> >
> > It's variable length, you can't say anything more.
>
> So what you are saying is that the constant '1' is variable length,
and
> there is no way to find out the maximum length from the database.

I have a PostgreSQL feature request:

Report the maximum size of a variable length string from the server.

Surely, we cannot be the only people who will need this information. If
(for example) someone wants to bind to a grid, then the maximum size has
to be known in advance.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2007-06-11 21:40:45 Re: Selecting a constant question
Previous Message Dann Corbit 2007-06-11 20:52:10 Re: Selecting a constant question