Re: Selecting a constant question

From: "Larry McGhaw" <lmcghaw(at)connx(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Dann Corbit" <DCorbit(at)connx(dot)com>, "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Selecting a constant question
Date: 2007-06-12 05:11:38
Message-ID: D425483C2C5C9F49B5B7A41F8944154707BE80@postal.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

As far as I am aware these statements are true. If you have a specific example you could provide to the contrary that would be interesting.

Even if there are such conditions it does not change the fact that libpq and/or postgresql is deficient in this area.

For any query, the database should be capable of describing the metadata for the columns, which includes
1) the column type
and
2) the column maximum length.

This is such a basic database interface principle that I very disappointed that someone has not recognized this and simply said " yes, we see the issue we will work on it".

Again, *all* other major relational databases do this ... even blob fields have a maximum length reported from the database.

I hope someone who truly understands database interfaces will read this thread and address the issue.
For now we will have to "special case" postgres in our application until it is addressed.

Thanks
lm

________________________________

From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Mon 6/11/2007 5:32 PM
To: Larry McGhaw
Cc: Alvaro Herrera; Dann Corbit; Gregory Stark; Martijn van Oosterhout; pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Selecting a constant question

"Larry McGhaw" <lmcghaw(at)connx(dot)com> writes:
> I think perhaps we have lost sight of the main issue:
> 1) libpq can properly describe the maximum internal data size of any
> numeric or char column in a table via Pqfsize
> 2) libpq can properly describe the maximum internal data size of any
> varchar column via Pqfmod
> 3) libpq can properly describe the maximum internal data size of any
> numeric constant in a SQL statement via Pqfsize

None of the above statements are actually true, at least not when you
take off your blinders and note the existence of unconstrained-width
numeric and text columns.

> The database *knows* this size of the char constant (obviously),

No, what it knows (and reports) is type information. There are a small
number of datatypes where you can infer a maximum width from knowledge
of the datatype. There are many others where you can't set an upper
bound from this knowledge --- at least not a usefully tight one.

Anyway, if we were to cast those constants to something other than
unknown, it would be text, not varchar, and you'd still have the same
issue.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2007-06-12 05:43:21 Re: Selecting a constant question
Previous Message Hannu Krosing 2007-06-12 03:41:55 Re: Selecting a constant question