Re: bytea question - Mailing list pgsql-general

From mikeo
Subject Re: bytea question
Date
Msg-id 3.0.1.32.20000815172338.009365b0@pop.spectrumtelecorp.com
Whole thread Raw
In response to Re: bytea question  (mjp@ornl.gov)
Responses Re: bytea question  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: bytea question  (mjp@ornl.gov)
Re: bytea question  (mjp@ornl.gov)
List pgsql-general
thanks anyway but that doesn't work.  i should've mentioned that i'd
already tried that in SQL.  my apologies.


tig4=# \d x
          Table "x"
 Attribute | Type  | Modifier
-----------+-------+----------
 tgargs    | bytea |

tig4=# select substr(tgargs,1,5) from x;
ERROR:  Function 'substr(bytea, int4, int4)' does not exist
 Unable to identify a function that satisfies the given argument types
 You may need to add explicit typecasts

tig4=# select substr(tgargs::text,1,5) from x;
ERROR:  Cannot cast type 'bytea' to 'text'

and other things like varchar, etc.

tig4=# select * from x;
                                    tgargs
------------------------------------------------------------------------------
 fk_uste_wu_id\000us_states\000web_users\000UNSPECIFIED\000wu_id\000wu_id\000
 fk_uste_wu_id\000us_states\000web_users\000UNSPECIFIED\000wu_id\000wu_id\000
 fk_uste_wu_id\000us_states\000web_users\000UNSPECIFIED\000wu_id\000wu_id\000

what i'm looking to do here is to get the table names and column names out
using sql.  i can do it in perl with a split command on '\' but was curious
as to how to "SQL" split up a BYTEA type field.

mikeo


At 04:38 PM 8/15/00 -0400, mjp@ornl.gov wrote:
>Try
>
>substr(text,int4) or
>substr(text, int4, int4)
>
>For example,
>
>
>% select substr('hi there',4,3);
> substr
>--------
> the
>(1 row)
>
>Morey Parang
>ORNL


pgsql-general by date:

Previous
From: "Campbell, Scott"
Date:
Subject: accessing field properties
Next
From: Armando "Racchumí" Piscoya
Date:
Subject: Error with PostgreSQL - IMP