Re: [GENERAL] how to read bytea field

2007-01-24 Thread Richard Huxton
marcelo Cortez wrote: Richard H i'm understood now!, sorry for the noise. The thing to remember is it's encode/decode from the point of view of the bytea type. So hex/escape are encodings of the "real" value. -- Richard Huxton Archonet Ltd ---(end of broa

Re: [GENERAL] how to read bytea field

2007-01-24 Thread marcelo Cortez
Richard H i'm understood now!, sorry for the noise. thanks very, very much best regards mdc --- Richard Huxton escribió: > marcelo Cortez wrote: > > ok my mistake , > > > > insert into pblfield( id_ , value_field ) > >values(1 ,encode(E'\\000\\001', 'escape') > ::bytea > > )

Re: [GENERAL] how to read bytea field

2007-01-24 Thread Richard Huxton
marcelo Cortez wrote: ok my mistake , insert into pblfield( id_ , value_field ) values(1 ,encode(E'\\000\\001', 'escape') ::bytea ) ; No. Use "decode" to convert text to bytea, and "encode" to convert bytea to text. => CREATE TABLE tb (b bytea); CREATE TABLE richardh=> INSERT INTO tb

Re: [GENERAL] how to read bytea field

2007-01-24 Thread marcelo Cortez
ok my mistake , insert into pblfield( id_ , value_field ) values(1 ,encode(E'\\000\\001', 'escape') ::bytea ) ; best regards mdc __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo q

Re: [GENERAL] how to read bytea field

2007-01-24 Thread Richard Huxton
marcelo Cortez wrote: folks my table CREATE TABLE pblfield ( id_ integer NOT NULL, value_field bytea, name character varying(128), osset integer, length integer, version_ integer, inst_class_ character varying(128), CONSTRAINT pblfield_pkey PRIMARY KEY (id_) ) insert in

Re: [GENERAL] how to read bytea field

2007-01-24 Thread marcelo Cortez
folks my table CREATE TABLE pblfield ( id_ integer NOT NULL, value_field bytea, name character varying(128), osset integer, length integer, version_ integer, inst_class_ character varying(128), CONSTRAINT pblfield_pkey PRIMARY KEY (id_) ) insert into pblfield( id_ , value_f

Re: [GENERAL] how to read bytea field

2007-01-24 Thread Markus Schiltknecht
Hi, marcelo Cortez wrote: Are you sure you tested with a real bytea field? Yeah , i store bytea using encode function , how you say . I never said 'use encode function to store bytea'. I tried to explain that encode returns TEXT. The field of my table is bytea type , and store real by

Re: [GENERAL] how to read bytea field

2007-01-24 Thread Shoaib Mir
Decode works as expected for me Try the following: select decode((encode(E'\\000\\001', 'escape')::text), 'escape'); --- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 1/24/07, marcelo Cortez <[EMAIL PROTECTED]> wrote: hi Markus ,folks > Are you sure you tested with a real

Re: [GENERAL] how to read bytea field

2007-01-24 Thread Richard Huxton
marcelo Cortez wrote: Are you sure you tested with a real bytea field? Yeah , i store bytea using encode function , how you say . No, you store using the decode function. => \df decode List of functions Schema | Name | Result data type | Argument data types ---

Re: [GENERAL] how to read bytea field

2007-01-24 Thread marcelo Cortez
hi Markus ,folks > Are you sure you tested with a real bytea field? Yeah , i store bytea using encode function , how you say . The field of my table is bytea type , and store real bytea data in this field. My problem is , i can't convert this field to text anymore, not function receiving

Re: [GENERAL] how to read bytea field

2007-01-24 Thread Markus Schiltknecht
Hi, marcelo Cortez wrote: Yes i know, but if your define bytea field and store bytea in this field , decode don't work, Sure it does: test=# select encode(E'\\000\\001', 'escape')::text; encode -- \000\x01 (1 row) If you inspect the function, you'll find that encode can *only

Re: [GENERAL] how to read bytea field

2007-01-24 Thread marcelo Cortez
Shoaib ,folks Yes i know, but if your define bytea field and store bytea in this field , decode don't work, because decode function has text parameter not bytea ,so how do that to read bytea field to text again? what function convert bytea to text? best regards mdc --- Shoaib Mir <

Re: [GENERAL] how to read bytea field

2007-01-24 Thread Shoaib Mir
This might help you: select encode(col1,'escape') from tblBytea; where col1 is of type bytea... - Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 1/24/07, marcelo Cortez <[EMAIL PROTECTED]> wrote: folks help me ,i cant read bytea type field's. how to convert bytea to text or