Thread: Field size

Field size

From
Martin
Date:
Ok, this should be simple. How do I find the defined maximum
length of a varchar field?

--
http://dating.blameitonlove.com/

Re: Field size

From
hubert depesz lubaczewski
Date:
On Sun, Jul 20, 2008 at 05:50:30PM -0500, Martin wrote:
> Ok, this should be simple. How do I find the defined maximum
> length of a varchar field?

http://www.postgresql.org/docs/faqs.FAQ.html#item4.4

depesz

Re: Field size

From
Ludwig Kniprath
Date:
>On Sun, Jul 20, 2008 at 05:50:30PM -0500, Martin wrote:
>> Ok, this should be simple. How do I find the defined maximum
>> length of a varchar field?

SELECT
   character_maximum_length
FROM
   information_schema.columns
WHERE
   table_schema = 'name_of_your_schema' and
   table_name = 'name_of_your_table' and
   column_name = 'name_of_your_column'

bye...
Ludwig

Re: Field size

From
Martin
Date:
hubert depesz lubaczewski <depesz@depesz.com> write:

> http://www.postgresql.org/docs/faqs.FAQ.html#item4.4

That's not what I'm looking for. I want the size limit defined
for the varchar field not the max size the database system can
handle, e.g. if the field is varchar(4) I want the 4.


Re: Field size

From
aliosa
Date:
Hello
I am using libpq to find information about fileds of table ( type and size).
I have a problem with getting the sizeof varchar fields.
If a table has a fiels varchar[35] and want to obtain 35.
I used PQgetlength or PQfsize  but is not good for my work.
Can someone tell me what function shall I use to get the size of filed ?

Thank you
Alin





--
View this message in context: http://postgresql.1045698.n5.nabble.com/Field-size-tp1878962p5720047.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: Field size

From
Dmitriy Igrishin
Date:
Hey aliosa

2012/8/16 aliosa <constantinica_alin@yahoo.com>
Hello
I am using libpq to find information about fileds of table ( type and size).
I have a problem with getting the sizeof varchar fields.
If a table has a fiels varchar[35] and want to obtain 35.
I used PQgetlength or PQfsize  but is not good for my work.
Can someone tell me what function shall I use to get the size of filed ?
You should use PQfmod().

--
// Dmitriy.