pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedoperator class
2+ messages / 2 participants
[nested] [flat]
* operator class
@ 2008-02-27 22:40 miquel_ibanez <miquel_ibanez@sumimail.com>
0 siblings, 1 reply; 2+ messages in thread
From: miquel_ibanez @ 2008-02-27 22:40 UTC (permalink / raw)
To: pgsql-sql
Hello
I have just started with postgreSQL.
I have a file with the following commands :
CREATE TYPE t_cod_t_activ AS (
cod_t_activ CHAR(10)
);
CREATE TABLE tip_activ (
id_tip_activ t_cod_t_activ,
des_t_activ t_des_t_activ
);
CREATE INDEX i_tip_activ ON tip_activ (id_tip_activ bpchar_pattern_ops);
When the CREATE INDEX is executed, this error shows:
ERROR: operator class "bpchar_pattern_ops" does not accept data type
t_cod_t_activ
Does it mean that I cannot create an index on a field wich is of a type
defined by the user?
I need that id_tip_activ be PRIMARY KEY.
Thanks and best regards
Miguel Ibáñez
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: operator class
@ 2008-02-28 05:30 Tom Lane <tgl@sss.pgh.pa.us>
parent: miquel_ibanez <miquel_ibanez@sumimail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2008-02-28 05:30 UTC (permalink / raw)
To: miquel_ibanez <miquel_ibanez@sumimail.com>; +Cc: pgsql-sql
"miquel_ibanez" <miquel_ibanez@sumimail.com> writes:
> CREATE TYPE t_cod_t_activ AS (
> cod_t_activ CHAR(10)
> );
If you just want an alias for char(10), a domain would probably work
better. CREATE TYPE AS is meant for creating multi-field row types.
> Does it mean that I cannot create an index on a field wich is of a type
> defined by the user?
Sure, if you are also willing to define operators and operator classes
on your type.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2008-02-28 05:30 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-02-27 22:40 operator class miquel_ibanez <miquel_ibanez@sumimail.com>
2008-02-28 05:30 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox