[BUG] Index operator class + collation = bad SQL

From: Thom Brown <thom(at)linux(dot)com>
To: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: [BUG] Index operator class + collation = bad SQL
Date: 2011-07-03 14:10:55
Message-ID: CAA-aLv6_gbV54MJ0iFRBjsKqeOLFH=Z7x=quBONHeurhPG8QLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi,

I noticed that when using PostgreSQL 9.1 and PgAdmin III 1.14 beta 2,
the operator class, sort order and whether nulls are first or last
appears before collation on a column when showing the index definition
in the SQL pane, but this is invalid syntax.

Test case:

CREATE TABLE dictionary (word text);

CREATE INDEX idx_test
ON dictionary
USING btree
(word COLLATE pg_catalog."zh_CN.utf8" text_pattern_ops DESC NULLS LAST);

Look at the SQL pane for that index and it will produce the following
invalid syntax:

CREATE INDEX idx_test
ON dictionary
USING btree
(word text_pattern_ops DESC NULLS LAST COLLATE pg_catalog."zh_CN.utf8");

Attached a patch to fix.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
index_collation_and_opclass_fix.patch text/x-patch 3.8 KB

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Thom Brown 2011-07-03 18:23:48 Updated sequence syntax
Previous Message Thom Brown 2011-07-03 11:34:39 Re: [FEATURE] OIDs check box to enable OIDs