c - postgres how to get column size for char varchar and text data types -


i'm trying column size query using postgres c api functions.

create table char_length_test (c char(3), vc varchar(5), t text) 

for example have query:

select c, vc, repeat(c, 1), t char_length_test 

i correct types, cant figure out how column size. i've tried using pqfsize , pqgetlength.

  • pqfsize returns -1, means variable size according postgres documentation while need column size.
  • pqgetlength returns 0, fine, since table not contain data, though not column size.

i'm expecting length 3 c, 5 'vc' , big value repeat(c, 1) function , t

to honest expecting functionality similar mysql_fetch_fields.

i think you're looking pqfmod.

the interpretation of modifier values type-specific; typically indicate precision or size limits. value -1 used indicate "no information available". data types not use modifiers, in case value -1.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -