Problem on pg_dump RANGE partition with expressions

Поиск
Список
Период
Сортировка
От Yugo Nagata
Тема Problem on pg_dump RANGE partition with expressions
Дата
Msg-id 20180712165939.36b12aff.nagata@sraoss.co.jp
обсуждение исходный текст
Ответы Re: Problem on pg_dump RANGE partition with expressions  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Список pgsql-hackers
Hi,

During looking into other thread[1], I found a problem on pg_dump of range
partition table using expressions. When we create a range partitioned table, 
we cannot use a column more than once in the partition key.
 
 postgres=# create table t (i int) partition by range(i,i);
 ERROR:  column "i" appears more than once in partition key

On the other hand, the following query using expression is allowed.

 postgres=# create table test (i int) partition by range(i,(i));
 CREATE TABLE

However, when we use pg_dump for this, we get

 CREATE TABLE public.test (
     i integer
 )
 PARTITION BY RANGE (i, i);

, and we cannot restore this due to the error.

I can consider three approaches to resolve this.


1) Allow to appear more than once in range partition key

I don't understand why there is this restriction. If we have no clear reason, 
can we rip out this restrition?

2) Forbid this kind of partition key

If we can make more checks and forbid such partition keys as RANGE(i,(i)), 
we can avoid the problem though it is a bit rigorous.

3) Treat expressions as it is

For some reasons, expressions like "(column)" or "(column COLLATE something)"
is treated like simple attributes in the current implementation
(in ComputePartitionAttr() ).

If we treat these expressions as it is, pg_dump result will be the same 
expression as when the partition table is created, and we can restore this 
successfully.

Could you give me your opinions aoubt which approach is appropriate?

Regards,

[1]
https://www.postgresql.org/message-id/flat/20180712155808.49e712d8.nagata%40sraoss.co.jp#00bbfb5054c0a57f9a2fe48fae77b848

-- 
Yugo Nagata <nagata@sraoss.co.jp>


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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: In pageinspect, perform clean-up after testing gin-related functions
Следующее
От: "samuel.coulee"
Дата:
Сообщение: Binary difference in pg_internal.init after running pg_initdbmultiple times