Thread: Unable to identify an operator '*=' for types 'character varying[]' and '"unknown"'

Okay.I'm following the documentation that came with the PostgreSQL source
code (located in /usr/doc/postgresql-7.3.4-2/html/arrays.hmtl in my cygwin
root).

I created have a table with a varchar array in it, kind of like the
following:

CREATE TABLE tbl_db_usuario_detalles (NOMBRE varchar(50), COD_USE
varchar(6)[]);

I've added a single record that has two values.  It is imported from a
tab-separated text file that has one line, like the following:

Username    {xxxxxx,yyyyyy}

The import seems to work fine (if I put quotes around the string values in
the array it fails).

When I do a select statement with the *= operator, I get the following
results:

db=# Select * from tbl_db_usuario_detalles where cod_use *= 'xxxxxx';
ERROR:  Unable to identify an operator '*=' for types 'character varying[]'
and '"unknown"'
        You will have to retype this query using an explicit cast

I don't really understand this error.  So I tried the next select statement,
which doesn't give me an error, but I get zero results, when I would have
guessed there would be:

Select * from tbl_db_usuario_detalles where cod_use[0] = 'xxxxxx';


I'm guessing the values I have for the array are not correct...any
suggestions?

Thanks,
Mike



Okay...I answered my own question.  I didn't understand from the directions
that I had to compile and install the dll in contrib/array and run the
array_iterator.sql.

It works like a charm now.

Mike

-----Original Message-----
From: Mike Leahy [mailto:mgleahy@fes.uwaterloo.ca]
Sent: October 10, 2003 3:41 PM
To: 'pgsql-general@postgresql.org'
Subject: Unable to identify an operator '*=' for types 'character varying[]'
and '"unknown"'

Okay.I'm following the documentation that came with the PostgreSQL source
code (located in /usr/doc/postgresql-7.3.4-2/html/arrays.hmtl in my cygwin
root).

I created have a table with a varchar array in it, kind of like the
following:

CREATE TABLE tbl_db_usuario_detalles (NOMBRE varchar(50), COD_USE
varchar(6)[]);

I've added a single record that has two values.  It is imported from a
tab-separated text file that has one line, like the following:

Username    {xxxxxx,yyyyyy}

The import seems to work fine (if I put quotes around the string values in
the array it fails).

When I do a select statement with the *= operator, I get the following
results:

db=# Select * from tbl_db_usuario_detalles where cod_use *= 'xxxxxx';
ERROR:  Unable to identify an operator '*=' for types 'character varying[]'
and '"unknown"'
        You will have to retype this query using an explicit cast

I don't really understand this error.  So I tried the next select statement,
which doesn't give me an error, but I get zero results, when I would have
guessed there would be:

Select * from tbl_db_usuario_detalles where cod_use[0] = 'xxxxxx';


I'm guessing the values I have for the array are not correct...any
suggestions?

Thanks,
Mike