Re: [INTERFACES] Getting max. value size (libpq++)
От | Peter T Mount |
---|---|
Тема | Re: [INTERFACES] Getting max. value size (libpq++) |
Дата | |
Msg-id | Pine.LNX.4.04.9907010654170.31519-100000@maidast.retep.org.uk обсуждение исходный текст |
Ответ на | Getting max. value size (libpq++) (Philippe Chaintreuil <peep@thefront.com>) |
Ответы |
Re: [INTERFACES] Getting max. value size (libpq++)
|
Список | pgsql-interfaces |
On Thu, 1 Jul 1999, Philippe Chaintreuil wrote: > Okay, maybe I'm just not finding it in the documentation, but is > there a way to find out the max size of a field? Specifically VARCHAR > fields. For instance if I have a table created with the SQL code: > > CREATE TABLE temp_table > ( name VARCHAR(30), > id VARCHAR(10), > address VARCHAR(60)); > > Now the program I'm writing will add whatever the user wants to > this table, of what ever size. I'm trying to avoid locking the size of > the HTML input fields. So is there anyway to get those numbers back from > Postgres? Right now they're hard-coded in, which really sucks. Thanks. You need to query the system tables to do this. Something like (I've not tested this, just lifting bits from the jdbc source): select a.attname,a.attlen from pg_attribute a,pg_class cwhere c.relname like 'temp_table' and a.attrelid=c.oid anda.attnum>0order by a.attnum; Peter -- Peter T Mount peter@retep.org.uk Main Homepage: http://www.retep.org.uk PostgreSQL JDBC Faq: http://www.retep.org.uk/postgresJava PDF Generator: http://www.retep.org.uk/pdf
В списке pgsql-interfaces по дате отправления: