Re: Schema + User-Defined Data Type Indexing problems...

From: Chris Gamache <cgg007(at)yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Schema + User-Defined Data Type Indexing problems...
Date: 2004-06-10 13:20:50
Message-ID: 20040610132050.94570.qmail@web13801.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


--- Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Chris Gamache <cgg007(at)yahoo(dot)com> writes:
> > I'm having a heck of a time, and it seems like in my thrashing about
> > to find a solution to this problem I have ruined the uniqueidentifier
> > datatype in the schema...
>
> > CREATE INDEX mt_uuid_idx
> > ON my_schema.my_table USING btree (my_uuid);
>
> > ERROR: data type my_schema.uniqueidentifier has no default operator class
> for
> > access method "btree"
> > HINT: You must specify an operator class for the index or define a default
> > operator class for the data type.
>
> > I can look at the operator classes and see that there is an operator class
> for
> > btree for my_schema.uniqueidentifier.
>
> IIRC, the opclass has to be in a schema that is in your schema search
> path to be found by CREATE INDEX by default. If it isn't, you could
> specify it explicitly:
>
> CREATE INDEX mt_uuid_idx
> ON my_schema.my_table USING btree (my_uuid USING my_schema.uuidopclass);
>
> It's possible that we could think of a more convenient behavior for
> default opclasses, but I don't want to do something that would foreclose
> having similarly-named datatypes in different schemas. You have any
> suggestions?

That /is/ important to be able to have similarly named datatypes in different
schemas. I'll give the explicit opclass a go. Indeed, if I place the schema in
my search path the index creation and index scans seem to work perfectly. I had
wanted to have to specify the schema whenever I referenced objects in it
instead of putting it in my search path. I had no concept of exactly how truly
separated schemas are. The only idea that I can think of (and, again, I may be
underestimating the level of separation that needs to exist between schema) is
that object creation could implicitly looks to the current schema for a usable
index/opclass/whatever first before checking the search path. A SELECT could
look first to the schema of the table before checking the search path for a
usable index. Is it even possible to create an index that lives in a different
schema from the table it is indexing?

CG



__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Martin Schäfer 2004-06-10 13:48:33 Re: Find out whether a view's column is indexed?
Previous Message Richard Huxton 2004-06-10 08:41:55 Re: Find out whether a view's column is indexed?