Partition key causes problem for volatile target list query

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Partition key causes problem for volatile target list query
Дата
Msg-id Y9MVwS6byAbzpnEi@momjian.us
обсуждение исходный текст
Ответы Re: Partition key causes problem for volatile target list query  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I have found an odd behavior --- a query in the target list that assigns
to a partitioned column causes queries that would normally be volatile
to return always zero.

In the first query, no partitioning is used:

     d1 | d2
    ----+----
      1 |  0
      2 |  0
      2 |  1
      1 |  0
      1 |  2
      1 |  2
      1 |  0
      0 |  2
      2 |  0
      2 |  2

In the next query, 'd1' is a partition key and it gets a constant value
of zero for all rows:

     d1 | d2
    ----+----
-->      0 |  1
-->      0 |  2
      0 |  2
      0 |  1
      0 |  2
      0 |  1
      0 |  2
      0 |  2
      0 |  2
      0 |  2

The self-contained query is attached.  The value is _always_ zero, which
suggests random() is not being called;  calling setseed() does not
change that.  If I change "SELECT x" with "SELECT 2", the "2" is used. 
I see this behavior back to PG 11.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

Embrace your flaws.  They make you human, rather than perfect,
which you will never be.

Вложения

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

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: Rework of collation code, extensibility
Следующее
От: Nathan Bossart
Дата:
Сообщение: Re: improving user.c error messages