[BUG] Index operator class + collation = bad SQL - Mailing list pgadmin-hackers

From Thom Brown
Subject [BUG] Index operator class + collation = bad SQL
Date
Msg-id CAA-aLv6_gbV54MJ0iFRBjsKqeOLFH=Z7x=quBONHeurhPG8QLg@mail.gmail.com
Whole thread Raw
Responses Re: [BUG] Index operator class + collation = bad SQL  (Guillaume Lelarge <guillaume@lelarge.info>)
List 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

pgadmin-hackers by date:

Previous
From: Thom Brown
Date:
Subject: Re: [FEATURE] OIDs check box to enable OIDs
Next
From: Thom Brown
Date:
Subject: Updated sequence syntax