Re: Constraint exclusion issue

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Constraint exclusion issue
Дата
Msg-id dcc563d11001161026m6af34db4h3de3f9e60f62129e@mail.gmail.com
обсуждение исходный текст
Ответ на Constraint exclusion issue  (Mathieu De Zutter <mathieu@dezutter.org>)
Ответы Re: Constraint exclusion issue  (Mathieu De Zutter <mathieu@dezutter.org>)
Список pgsql-general
On Sat, Jan 16, 2010 at 11:02 AM, Mathieu De Zutter
<mathieu@dezutter.org> wrote:
> Hi,
>
> I'm trying to make constraint exclusion work correctly in a query with
> only one parameter, but I have some issues.
> Please have a look at the scenario below and tell me how I can improve it.
>
> Thanks!
>
>
> -- I create an inheritance relationship with a check constraint in the child
>
> shs-dev=# create table parent (c char, n integer);
> CREATE TABLE
> shs-dev=# create table child1 ( ) inherits (parent);
> CREATE TABLE
> shs-dev=# alter table child1 add check (c = 'a');
> ALTER TABLE
>
> -- I query on a row containing both attributes, and pgsql 8.4
> correctly skips the child table because of the constraint
>
> shs-dev=# explain select * from parent where (c,n) = ('b',0);
>                                                  QUERY PLAN
> --------------------------------------------------------------------------------------------------------------
>  Result  (cost=0.00..39.10 rows=1 width=12)
>   ->  Append  (cost=0.00..39.10 rows=1 width=12)
>         ->  Seq Scan on parent  (cost=0.00..39.10 rows=1 width=12)
>               Filter: ((c = 'b'::bpchar) AND (n = 0))
>
> -- Ok, lets see if I can parameterize this with only one parameter... NO!
>
> shs-dev=# explain select * from parent where (c,n) = '("b",0)';
> ERROR:  input of anonymous composite types is not implemented

Shouldn't that be 'b' not "b" ?

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

Предыдущее
От: Mathieu De Zutter
Дата:
Сообщение: Constraint exclusion issue
Следующее
От: "Lothar Bongartz"
Дата:
Сообщение: SELECT is causing a runtime error when used in stored functions: State=42601, Err=7, Msg=ERROR: query has no destination for result data;