If you create a partitioned table in the obvious way, partcollation ends up 0:

rhaas=# create table foo (a int, b text) partition by list (a);
CREATE TABLE
rhaas=# select * from pg_partitioned_table;
 partrelid | partstrat | partnatts | partattrs | partclass |
partcollation | partexprs
-----------+-----------+-----------+-----------+-----------+---------------+-----------
     16420 | l         |         1 | 1         | 1978      | 0             |
(1 row)

You could argue that 0 is an OK value there; offhand, I'm not sure
about that.  But there's nothing in
https://www.postgresql.org/docs/10/static/catalog-pg-partitioned-table.html
which indicates that some entries can be 0 rather than a valid
collation OID.  And this is definitely not OK:

rhaas=# select * from pg_depend where objid = 16420;
 classid | objid | objsubid | refclassid | refobjid | refobjsubid | deptype
---------+-------+----------+------------+----------+-------------+---------
    1259 | 16420 |        0 |       2615 |     2200 |           0 | n
    1259 | 16420 |        0 |       3456 |        0 |           0 | n
(2 rows)

We shouldn't be storing a dependency on non-existing collation 0.

I'm not sure whether the bug here is that we should have a valid
collation OID there rather than 0, or whether the bug is that we
shouldn't be recording a dependency on anything other than a real
collation OID, but something about this is definitely not right.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to