Re: Querying the schema for column widths - what syntax do I use?

From: Howard Wilkinson <howard(at)cohtech(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Querying the schema for column widths - what syntax do I use?
Date: 2008-02-21 12:42:51
Message-ID: 47BD71CB.6040501@cohtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton wrote:
> Howard Wilkinson wrote:
>> I am working on some upgrades to the MyDNS open source product. I
>> have some expertise in MySQL but am not overly familiar with
>> PostgreSQL and need some guidance on how to query the schema for the
>> maximum size of data a column can hold.
>
> Unless you're after PG-specific stuff, it's probably best to use the
> information-schema.
>
> http://www.postgresql.org/docs/8.3/static/information-schema.html
>
> This has a standard layout cross-database, so will help you to extend
> you app across other systems. I think it's supported in the latest
> version of MySQL too.
>
SO I can do something like this?

select character_maximum_length from information_schema.columns where
table_name='rr' and column_name='data';

Yes?

--

Howard Wilkinson

Phone:

+44(20)76907075

Coherent Technology Limited

Fax:

23 Northampton Square,

Mobile:

+44(7980)639379

United Kingdom, EC1V 0HL

Email:

howard(at)cohtech(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Kempter 2008-02-21 13:51:01 Re: How to view temp tables
Previous Message Richard Huxton 2008-02-21 12:00:25 Re: ts_headline