Re: [HACKERS] Re: [INTERFACES] retrieving varchar size - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Re: [INTERFACES] retrieving varchar size
Date
Msg-id 199804280217.WAA01689@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] Re: [INTERFACES] retrieving varchar size  ("Thomas G. Lockhart" <lockhart@alumni.caltech.edu>)
List pgsql-hackers
>
> > > > We could pass back atttypmod as part of the PGresult.  I can add
> > > > that to the TODO list.  Would that help?
> > > Yes, that would do it!
> > > Thank you for listening to our ravings on this issue.
> > Added to TODO:
> > * Add pg_attribute.atttypmod/Resdom->restypmod to PGresult structure
> > This is a good suggestion.
>
> How do we determine atttypmod for queries like
>
>   select '123' || '456';
>
> ?? I might be able to address this with my upcoming type conversion work
> but I don't know if we have enough hooks for this right now...

No way, I think.  This would have a atttypmod of -1, which is true
because there is no atttypmod size for this.  Once a char()/varchar()
goes into a function, anything can come out.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

pgsql-hackers by date:

Previous
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] Re: [QUESTIONS] Practical SQL Handbook - demo script for postgreSQL
Next
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] initdb problem and operator question