Re: simple function index question

Поиск
Список
Период
Сортировка
От Igor Neyman
Тема Re: simple function index question
Дата
Msg-id A76B25F2823E954C9E45E32FA49D70ECCD680733@mail.corp.perceptron.com
обсуждение исходный текст
Ответ на Re: simple function index question  (Igor Neyman <ineyman@perceptron.com>)
Список pgsql-sql

 

 

From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Igor Neyman
Sent: Wednesday, March 23, 2016 11:57 AM
To: Michael Moore <michaeljmoore@gmail.com>; postgres list <pgsql-sql@postgresql.org>
Subject: Re: [SQL] simple function index question

 

 

From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Michael Moore
Sent: Wednesday, March 23, 2016 11:14 AM
To: postgres list <pgsql-sql@postgresql.org>
Subject: Re: [SQL] simple function index question

 

Thanks guys,

I agree that the data model is suspect. I'm trying to convert from Oracle to Postgres and changing table structures is not really an option for me. I tried casting the null, ... same problem. It does not like the undefined record type as David is saying. I will try his solution and let you know how it goes.

 

 

Interestingly a version of this:

 

CREATE INDEX TX_QSET_DIR_MAP_PRI_URI_TYP_UK

  ON tx_question_set_dir_map

  USING btree

  (question_set2tx_question_set ,uri_type,

  (CASE WHEN uri_type = 201900 THEN null::varchar(100)

     ELSE question_set_dir_map_key END);

 

Worked for me.  Try it if you are still interested.

Just do proper casting of null (it was varchar(100) in my case).

 

Regards,

Igor Neyman

 

 

Of course, missed “)” at the end:

 

CREATE INDEX TX_QSET_DIR_MAP_PRI_URI_TYP_UK

  ON tx_question_set_dir_map

  USING btree

  (question_set2tx_question_set ,uri_type,

  (CASE WHEN uri_type = 201900 THEN null::varchar(100)

     ELSE question_set_dir_map_key END));

 

 

Regards,

Igor

 

 

 

В списке pgsql-sql по дате отправления:

Предыдущее
От: Igor Neyman
Дата:
Сообщение: Re: simple function index question
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: simple function index question