-
Notifications
You must be signed in to change notification settings - Fork 22k
Closed
Description
Steps to reproduce
Use Rails 6.0.3.3 with PostgreSQL and use the pg_class
table:
class PgClass < ActiveRecord::Base
self.table_name = 'pg_class'
self.primary_key = 'oid'
end
PgClass.all
Expected behavior
No warning messages.
Actual behavior
unknown OID 28: failed to recognize type of 'relfrozenxid'. It will be treated as String.
unknown OID 1034: failed to recognize type of 'relacl'. It will be treated as String.
unknown OID 194: failed to recognize type of 'relpartbound'. It will be treated as String.
It looks like this error is coming from:
warn "unknown OID #{oid}: failed to recognize type of '#{column_name}'. It will be treated as String." |
# SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
FROM pg_type as t
LEFT JOIN pg_range as r ON oid = rngtypid
where oid IN (28, 1034, 194);
oid | typname | typelem | typdelim | typinput | rngsubtype | typtype | typbasetype
------+--------------+---------+----------+-----------------+------------+---------+-------------
28 | xid | 0 | , | xidin | | b | 0
194 | pg_node_tree | 0 | , | pg_node_tree_in | | b | 0
1034 | _aclitem | 1033 | , | array_in | | b | 0
(3 rows)
# \d+ pg_class;
Table "pg_catalog.pg_class"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
---------------------+--------------+-----------+----------+---------+----------+--------------+-------------
oid | oid | | not null | | plain | |
relname | name | | not null | | plain | |
relnamespace | oid | | not null | | plain | |
reltype | oid | | not null | | plain | |
reloftype | oid | | not null | | plain | |
relowner | oid | | not null | | plain | |
relam | oid | | not null | | plain | |
relfilenode | oid | | not null | | plain | |
reltablespace | oid | | not null | | plain | |
relpages | integer | | not null | | plain | |
reltuples | real | | not null | | plain | |
relallvisible | integer | | not null | | plain | |
reltoastrelid | oid | | not null | | plain | |
relhasindex | boolean | | not null | | plain | |
relisshared | boolean | | not null | | plain | |
relpersistence | "char" | | not null | | plain | |
relkind | "char" | | not null | | plain | |
relnatts | smallint | | not null | | plain | |
relchecks | smallint | | not null | | plain | |
relhasrules | boolean | | not null | | plain | |
relhastriggers | boolean | | not null | | plain | |
relhassubclass | boolean | | not null | | plain | |
relrowsecurity | boolean | | not null | | plain | |
relforcerowsecurity | boolean | | not null | | plain | |
relispopulated | boolean | | not null | | plain | |
relreplident | "char" | | not null | | plain | |
relispartition | boolean | | not null | | plain | |
relrewrite | oid | | not null | | plain | |
relfrozenxid | xid | | not null | | plain | |
relminmxid | xid | | not null | | plain | |
relacl | aclitem[] | | | | extended | |
reloptions | text[] | C | | | extended | |
relpartbound | pg_node_tree | C | | | extended | |
Indexes:
"pg_class_oid_index" UNIQUE, btree (oid)
"pg_class_relname_nsp_index" UNIQUE, btree (relname, relnamespace)
"pg_class_tblspc_relfilenode_index" btree (reltablespace, relfilenode)
Access method: heap
Do we just need to register these manually?
For example, relfrozenxid
has been around for a while: https://www.postgresql.org/docs/9.5/routine-vacuuming.html
System configuration
Rails version: 6.0.3.3
Ruby version: 2.7.2
Metadata
Metadata
Assignees
Labels
No labels