From: | Philippe Chaintreuil <peep(at)thefront(dot)com> |
---|---|
To: | Peter T Mount <peter(at)retep(dot)org(dot)uk> |
Cc: | pgsql-interfaces(at)postgreSQL(dot)org |
Subject: | Re: [INTERFACES] Getting max. value size (libpq++) |
Date: | 1999-07-02 10:28:45 |
Message-ID: | Pine.LNX.3.96.990702032049.27906A-100000@pravda.thefront.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
On Thu, 1 Jul 1999, Peter T Mount 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 c
> where c.relname like 'temp_table'
> and a.attrelid=c.oid
> and a.attnum>0
> order by a.attnum;
Thanks for the idea, but it it isn't able to tell me what the max.
size of varchars are. It returns -1 for them. I think this must be the
method that the libpq++ (PgDatabase).FieldSize(int), as it returns those
same numbers.
I'm pretty sure there's a way to do what I want, as the command
pg_dumpall (from a shell), some how has the numbers that I want.
-- Philippe Chaintreuil
peep(at)thefront(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | StOo | 1999-07-02 15:02:40 | required includes |
Previous Message | Hub.Org News Admin | 1999-07-02 09:04:43 |