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_field ) values( 1 ,
encode(E'\\000\\001', 'escape') ) ; 
 insert into pblfield( id_ , value_field ) values( 2 ,
encode(E'\\000\\002', 'escape') ) ; 
 etc...

 now, i want to recover value_field in text form 
some thing like.. 


  select id_ , decode(value_field) from pblfield ; 

  WRONG WRONG ... decode has text parameter ...!!!!!

  Ok ,next try .

  select id_ , decode(value_field ::text ) from
pblfield. 

  WRONG WRONG ... bytea not cast to string  ...!!!!!

  so, how do that ???


  I think solution is:   

CREATE TABLE pblfield
(
  id_ integer NOT NULL,
  value_field text ,   /*!!!!  here text field */
  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_field ) values( 1 ,
encode('\\000\\001', 'escape')::text  ) ; 
 insert into pblfield( id_ , value_field ) values( 2 ,
encode(E'\\000\\002', 'escape') ::text  ) ; 

  select id_ , value_field from  pblfield ; 

  works  and 
  select id_ , decode(value_field ,'escaped' )  from 
pblfield ;  

  works too!!!
        
  folks thanks for your time and responses.
  best regards  

 Last cuestion , when bytea field ( type)   is usable?

 for storage to external files???



 


        

        
                
__________________________________________________ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to