Re: How to get the size of non fixed-length field from system catalog ?
В списке pgsql-general по дате отправления:
| От | Thomas Kellerer |
|---|---|
| Тема | Re: How to get the size of non fixed-length field from system catalog ? |
| Дата | |
| Msg-id | h0jvff$5vj$1@ger.gmane.org обсуждение исходный текст |
| Ответ на | How to get the size of non fixed-length field from system catalog ? (Postgres User <postgres.developer@gmail.com>) |
| Список | pgsql-general |
Postgres User wrote on 08.06.2009 23:03: > Hi, > > I'm writing a small ORM tool and have written a number of queries to > retrieve table metadata. One piece of data that I'm having trouble > hunting down is the size of a CHAR field. For example, one table has > a 'user_id' column of type CHAR(36). But when I look at the > pg_attribute and pg_type tables, I can't seem to find this size value > of 36. > > Can anyone share the SQL that returns the size of a CHAR? It is NOT > the 'typlen' column. The answer may be the 'typelem' column, but I > can't find details on how to decode it. > Use the information_schema, that is easier: SELECT character_maximum_length FROM information_schema.columns WHERE table_name = 'your_table' AND column_name = 'the_char_column'; http://www.postgresql.org/docs/8.3/static/infoschema-columns.html Thomas
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера