Field size

Started by Martinover 17 years ago6 messagesgeneral
Jump to latest
#1Martin
martin@cornhobble.com

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

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

In reply to: Martin (#1)
Re: Field size

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

#3Martin
martin@cornhobble.com
In reply to: Martin (#1)
Re: Field size

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.

#4Ludwig Kniprath
ludwig@kni-online.de
In reply to: Martin (#3)
Re: Field size

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

#5aliosa
constantinica_alin@yahoo.com
In reply to: Ludwig Kniprath (#4)
Re: Field size

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.

#6Dmitriy Igrishin
dmitigr@gmail.com
In reply to: aliosa (#5)
Re: Field size

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.