Re: [GENERAL] PQfformat question and retrieving bytea data in C

2012-08-30 Thread Dmitriy Igrishin
2012/8/30 Albe Laurenz > Jason Armstrong wrote: > > I have updated my C library to return the binary data correctly. I > > note the restriction on not being able to retrieve different columns > > in different formats. > > Actually, PostgreSQL supports that if you use the line protocol > to talk t

Re: [GENERAL] PQfformat question and retrieving bytea data in C

2012-08-30 Thread Albe Laurenz
Jason Armstrong wrote: > I have updated my C library to return the binary data correctly. I > note the restriction on not being able to retrieve different columns > in different formats. Actually, PostgreSQL supports that if you use the line protocol to talk to the server (see the description of "

Re: [GENERAL] PQfformat question and retrieving bytea data in C

2012-08-30 Thread Jason Armstrong
Thank-you for the thoughtful answers. I have updated my C library to return the binary data correctly. I note the restriction on not being able to retrieve different columns in different formats. I found that my perl DBI interface wasn't happy either with the 'escape' output format, so I changed

Re: [GENERAL] PQfformat question and retrieving bytea data in C

2012-08-29 Thread Chris Angelico
On Wed, Aug 29, 2012 at 10:30 PM, Jason Armstrong wrote: > I see the following: > 30 5c 33 33 32 5c 30 30 30 5c 30 31 31 5c 30 30 > > But when I look at the same data in the database: > > psql> select encode(substr(data, 0, 16), 'hex') from data_table where > id='xxx'; > encode > ---

Re: [GENERAL] PQfformat question and retrieving bytea data in C

2012-08-29 Thread Merlin Moncure
On Wed, Aug 29, 2012 at 8:05 AM, Dmitriy Igrishin wrote: > Hey Jason, > > 2012/8/29 Jason Armstrong >> >> I have a question regarding the return value of PQfformat() >> >> I have a 'data' column in my table, type bytea (postgresql 9.1.5). >> >> In postgresql.conf: >> bytea_output = 'escape' >> >>

Re: [GENERAL] PQfformat question and retrieving bytea data in C

2012-08-29 Thread Dmitriy Igrishin
Hey Jason, 2012/8/29 Jason Armstrong > I have a question regarding the return value of PQfformat() > > I have a 'data' column in my table, type bytea (postgresql 9.1.5). > > In postgresql.conf: > bytea_output = 'escape' > > When I execute the query: > PGresult *res = PQexec(db, "SELECT data::byt

[GENERAL] PQfformat question and retrieving bytea data in C

2012-08-29 Thread Jason Armstrong
I have a question regarding the return value of PQfformat() I have a 'data' column in my table, type bytea (postgresql 9.1.5). In postgresql.conf: bytea_output = 'escape' When I execute the query: PGresult *res = PQexec(db, "SELECT data::bytea FROM data_table WHERE id='xxx'") And I run through