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

Поиск
Список
Период
Сортировка
От Tino Wildenhain
Тема Re: Querying the schema for column widths - what syntax do I use?
Дата
Msg-id 47BE9F3E.8070707@wildenhain.de
обсуждение исходный текст
Ответ на Querying the schema for column widths - what syntax do I use?  (Howard Wilkinson <howard@cohtech.com>)
Ответы Re: Querying the schema for column widths - what syntax do I use?
Список pgsql-general
Hi Howard,

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.
>
> In MySQL I can do either: a "DESCRIBE" command or do "SELECT COLUMNS"
> command. And then parse the result for the length in the type column of
> the row returned. How would I do a similar function using PostgreSQL - I
> have tried to find this in the manuals and in this mailing list but not
> found any pointers to get me started.
>
> Apologies for asking such a simple question but I am being a bit lazy as
> I want to get on with releasing the MyDNS code.

beside the correct answers you got relating the informational_schema,
since I do not know what MyDNS is and what you are doing with the
maximum size of the column, are you aware that postgresql bails out
if you put in a string which exceeds the column size (so you can just
try rather then check beforehand if thats what you do) or you also
get the description in the cursor when you do the select on a table.

Also, text type could be used to hold potentially large strings without
harm (so if the string is short, its no difference but you can easily go
up to over a gig)

Regards
Tino

В списке pgsql-general по дате отправления:

Предыдущее
От: Stephen Davies
Дата:
Сообщение: Re: ts_headline
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: ts_headline