From miquel_ibanez@sumimail.com Wed Feb 27 22:40:50 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AABFD2E005F for ; Wed, 27 Feb 2008 18:40:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 09979-08 for ; Wed, 27 Feb 2008 18:40:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from nox.microblau.net (ns1.microblau.net [62.97.115.116]) by postgresql.org (Postfix) with ESMTP id 5963A2E006C for ; Wed, 27 Feb 2008 18:40:47 -0400 (AST) Received: (qmail 3663 invoked by uid 1008); 27 Feb 2008 22:40:45 -0000 Received: from 89.131.8.142 (miquel_ibanez@sumimail.com@89.131.8.142) by nox (envelope-from , uid 89) with qmail-scanner-2.01st (clamdscan: 0.88.6/2213. perlscan: 2.01st. Clear:RC:1(89.131.8.142):. Processed in 0.033449 secs); 27 Feb 2008 22:40:45 -0000 Received: from unknown (HELO miguelvell) (miquel?ibanez@sumimail.com@89.131.8.142) by nox.microblau.net with ESMTPA; 27 Feb 2008 22:40:45 -0000 From: "miquel_ibanez" To: Subject: operator class Date: Wed, 27 Feb 2008 23:40:45 +0100 Message-ID: <000e01c87991$cab4bb40$6402a8c0@miguelvell> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000F_01C8799A.2C792340" X-Mailer: Microsoft Office Outlook 11 Thread-Index: Ach5kcozcHo+XGnoSluL9Ly/w6B4LA== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.6 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001, RCVD_NUMERIC_HELO=2.599 X-Spam-Level: ** X-Archive-Number: 200802/226 X-Sequence-Number: 30317 This is a multi-part message in MIME format. ------=_NextPart_000_000F_01C8799A.2C792340 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello=20 =20 I have just started with postgreSQL.=20 =20 I have a file with the following commands : =20 CREATE TYPE t_cod_t_activ AS ( cod_t_activ CHAR(10) ); =20 CREATE TABLE tip_activ ( id_tip_activ t_cod_t_activ, des_t_activ t_des_t_activ ); =20 CREATE INDEX i_tip_activ ON tip_activ (id_tip_activ bpchar_pattern_ops); =20 When the CREATE INDEX is executed, this error shows: =20 ERROR: operator class "bpchar_pattern_ops" does not accept data type t_cod_t_activ =20 Does it mean that I cannot create an index on a field wich is of a type defined by the user? =20 I need that id_tip_activ be PRIMARY KEY. =20 Thanks and best regards =20 Miguel Ib=E1=F1ez =20 ------=_NextPart_000_000F_01C8799A.2C792340 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

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          &= nbsp; t_cod_t_activ,

      des_t_activ          &n= bsp;  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=E1=F1ez

 

------=_NextPart_000_000F_01C8799A.2C792340-- From tgl@sss.pgh.pa.us Thu Feb 28 05:30:49 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 041102E0051 for ; Thu, 28 Feb 2008 01:30:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 19297-06 for ; Thu, 28 Feb 2008 01:30:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 7067B2E004D for ; Thu, 28 Feb 2008 01:30:45 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m1S5Ui7L017913; Thu, 28 Feb 2008 00:30:44 -0500 (EST) To: "miquel_ibanez" cc: pgsql-sql@postgresql.org Subject: Re: operator class In-reply-to: <000e01c87991$cab4bb40$6402a8c0@miguelvell> References: <000e01c87991$cab4bb40$6402a8c0@miguelvell> Comments: In-reply-to "miquel_ibanez" message dated "Wed, 27 Feb 2008 23:40:45 +0100" Date: Thu, 28 Feb 2008 00:30:44 -0500 Message-ID: <17912.1204176644@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/231 X-Sequence-Number: 30322 "miquel_ibanez" 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