pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedOID out of range
9+ messages / 6 participants
[nested] [flat]
* OID out of range
@ 2020-01-15 18:18 Konireddy Rajashekar <rajkonireddy@gmail.com>
0 siblings, 2 replies; 9+ messages in thread
From: Konireddy Rajashekar @ 2020-01-15 18:18 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org; +Cc: rajkonireddy@gmail.com
I am getting ERROR: OID out of range while firing below SQL , what could be
the reason? I am joining pg_class and one user_created table to compare
tables size.
select u.relid,c.relnamespace::regnamespace::text,c.relname,now() as
current_time,pg_size_pretty(pg_relation_size(c.oid)) as
current_size,pg_size_pretty(u.table_size) as
previous_size,pg_size_pretty(pg_relation_size(c.oid) -
pg_relation_size(u.table_size)) as diff from user_tables_sizes u join
pg_class c on u.relid::bigint = c.oid::bigint where c.relkind='r'
and c.relnamespace::regnamespace::text='rpx_reporting_stage' and
u.captured_dt::date=current_date - interval '1 days'ERROR: OID out of
rangetest-# \d user_tables_sizes
Table "user_tables_sizes"
Column | Type | Collation | Nullable | Default
-------------+-----------------------------+-----------+----------+---------
relid | numeric | | |
table_size | bigint | | |
captured_dt | timestamp without time zone | | |
Indexes:
"user_tables_sizes_relid_captured_dt_idx" UNIQUE, btree (relid,
(captured_dt::date))\d pg_class
Table "pg_catalog.pg_class"
Column | Type | Collation | Nullable | Default
---------------------+--------------+-----------+----------+---------
relname | name | | not null |
relnamespace | oid | | not null |
reltype | oid | | not null |
reloftype | oid | | not null |
relowner | oid | | not null |
relam | oid | | not null |
relfilenode | oid | | not null |
reltablespace | oid | | not null |
relpages | integer | | not null |
reltuples | real | | not null |
relallvisible | integer | | not null |
reltoastrelid | oid | | not null |
relhasindex | boolean | | not null |
relisshared | boolean | | not null |
relpersistence | "char" | | not null |
relkind | "char" | | not null |
relnatts | smallint | | not null |
relchecks | smallint | | not null |
relhasoids | boolean | | not null |
relhaspkey | boolean | | not null |
relhasrules | boolean | | not null |
relhastriggers | boolean | | not null |
relhassubclass | boolean | | not null |
relrowsecurity | boolean | | not null |
relforcerowsecurity | boolean | | not null |
relispopulated | boolean | | not null |
relreplident | "char" | | not null |
relispartition | boolean | | not null |
relfrozenxid | xid | | not null |
relminmxid | xid | | not null |
relacl | aclitem[] | | |
reloptions | text[] | | |
relpartbound | pg_node_tree | | |
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: OID out of range
@ 2020-01-15 18:29 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Konireddy Rajashekar <rajkonireddy@gmail.com>
1 sibling, 1 reply; 9+ messages in thread
From: Adrian Klaver @ 2020-01-15 18:29 UTC (permalink / raw)
To: Konireddy Rajashekar <rajkonireddy@gmail.com>; pgsql-general@lists.postgresql.org
On 1/15/20 10:18 AM, Konireddy Rajashekar wrote:
> I am getting ERROR: OID out of range while firing below SQL , what could
> be the reason? I am joining pg_class and one user_created table to
> compare tables size.
>
> select u.relid,c.relnamespace::regnamespace::text,c.relname,now() as current_time,pg_size_pretty(pg_relation_size(c.oid)) as current_size,pg_size_pretty(u.table_size) as previous_size,pg_size_pretty(pg_relation_size(c.oid) - pg_relation_size(u.table_size)) as diff from user_tables_sizes u join pg_class c on u.relid::bigint = c.oid::bigint where c.relkind='r' and c.relnamespace::regnamespace::text='rpx_reporting_stage' and u.captured_dt::date=current_date - interval '1 days'ERROR: OID out of rangetest-# \d user_tables_sizes
Given this:
https://www.postgresql.org/docs/12/datatype-oid.html
"The oid type is currently implemented as an unsigned four-byte integer. "
I am pretty sure this:
c.oid::bigint
is the problem.
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: OID out of range
@ 2020-01-15 18:36 bhargav kamineni <bhargavpostgres@gmail.com>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 9+ messages in thread
From: bhargav kamineni @ 2020-01-15 18:36 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Konireddy Rajashekar <rajkonireddy@gmail.com>; pgsql-general@lists.postgresql.org
Any workaround to make it work ?
On Thu, 16 Jan 2020 at 00:00, Adrian Klaver <adrian.klaver@aklaver.com>
wrote:
> On 1/15/20 10:18 AM, Konireddy Rajashekar wrote:
> > I am getting ERROR: OID out of range while firing below SQL , what could
> > be the reason? I am joining pg_class and one user_created table to
> > compare tables size.
> >
> > select u.relid,c.relnamespace::regnamespace::text,c.relname,now() as
> current_time,pg_size_pretty(pg_relation_size(c.oid)) as
> current_size,pg_size_pretty(u.table_size) as
> previous_size,pg_size_pretty(pg_relation_size(c.oid) -
> pg_relation_size(u.table_size)) as diff from user_tables_sizes u join
> pg_class c on u.relid::bigint = c.oid::bigint where c.relkind='r' and
> c.relnamespace::regnamespace::text='rpx_reporting_stage' and
> u.captured_dt::date=current_date - interval '1 days'ERROR: OID out of
> rangetest-# \d user_tables_sizes
>
> Given this:
>
> https://www.postgresql.org/docs/12/datatype-oid.html
> "The oid type is currently implemented as an unsigned four-byte integer. "
>
> I am pretty sure this:
>
> c.oid::bigint
>
> is the problem.
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
>
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: OID out of range
@ 2020-01-15 18:42 David G. Johnston <david.g.johnston@gmail.com>
parent: bhargav kamineni <bhargavpostgres@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: David G. Johnston @ 2020-01-15 18:42 UTC (permalink / raw)
To: bhargav kamineni <bhargavpostgres@gmail.com>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; Konireddy Rajashekar <rajkonireddy@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
On Wed, Jan 15, 2020 at 11:36 AM bhargav kamineni <bhargavpostgres@gmail.com>
wrote:
> Any workaround to make it work ?
>
Convert both to text and join on that? Curious choice making relid
numeric...
David J.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: OID out of range
@ 2020-01-15 19:00 Konireddy Rajashekar <rajkonireddy@gmail.com>
parent: David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Konireddy Rajashekar @ 2020-01-15 19:00 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: bhargav kamineni <bhargavpostgres@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
tried casting to text,varchar but no luck
select u.relid,c.relnamespace::regnamespace::text,c.relname,now() as
current_time,pg_size_pretty(pg_relation_size(c.oid)) as
current_size,pg_size_pretty(u.table_size) as
previous_size,pg_size_pretty(pg_relation_size(c.oid) -
pg_relation_size(u.table_size)) as diff from user_tables_sizes u join
pg_class c on u.relid::varchar= c.oid::varchar where c.relkind='r' and
c.relnamespace::regnamespace::text='rpx_reporting_stage' and
u.captured_dt::date=current_date - interval '1 days'
;
ERROR: OID out of range
On Thu, Jan 16, 2020 at 12:12 AM David G. Johnston <
david.g.johnston@gmail.com> wrote:
> On Wed, Jan 15, 2020 at 11:36 AM bhargav kamineni <
> bhargavpostgres@gmail.com> wrote:
>
>> Any workaround to make it work ?
>>
>
> Convert both to text and join on that? Curious choice making relid
> numeric...
>
> David J.
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: OID out of range
@ 2020-01-15 19:11 Alvaro Herrera <alvherre@2ndquadrant.com>
parent: Konireddy Rajashekar <rajkonireddy@gmail.com>
1 sibling, 1 reply; 9+ messages in thread
From: Alvaro Herrera @ 2020-01-15 19:11 UTC (permalink / raw)
To: Konireddy Rajashekar <rajkonireddy@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
On 2020-Jan-15, Konireddy Rajashekar wrote:
> rangetest-# \d user_tables_sizes
> Table "user_tables_sizes"
> Column | Type | Collation | Nullable | Default
> -------------+-----------------------------+-----------+----------+---------
> relid | numeric | | |
Why do you have this column defined as numeric? It seems more sensible
to have it as type oid; it's probably that column where you have the
out-of-range values.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: OID out of range
@ 2020-01-15 19:17 Konireddy Rajashekar <rajkonireddy@gmail.com>
parent: Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 1 reply; 9+ messages in thread
From: Konireddy Rajashekar @ 2020-01-15 19:17 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
@Alvaro Herrera, Can i alter the datatype of relid to oid and try ?
On Thu, Jan 16, 2020 at 12:41 AM Alvaro Herrera <alvherre@2ndquadrant.com>
wrote:
> On 2020-Jan-15, Konireddy Rajashekar wrote:
>
> > rangetest-# \d user_tables_sizes
> > Table "user_tables_sizes"
> > Column | Type | Collation | Nullable |
> Default
> >
> -------------+-----------------------------+-----------+----------+---------
> > relid | numeric | | |
>
> Why do you have this column defined as numeric? It seems more sensible
> to have it as type oid; it's probably that column where you have the
> out-of-range values.
>
> --
> Álvaro Herrera https://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: OID out of range
@ 2020-01-15 19:20 David G. Johnston <david.g.johnston@gmail.com>
parent: Konireddy Rajashekar <rajkonireddy@gmail.com>
0 siblings, 0 replies; 9+ messages in thread
From: David G. Johnston @ 2020-01-15 19:20 UTC (permalink / raw)
To: Konireddy Rajashekar <rajkonireddy@gmail.com>; +Cc: bhargav kamineni <bhargavpostgres@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Please don't top-post here.
On Wed, Jan 15, 2020 at 12:01 PM Konireddy Rajashekar <
rajkonireddy@gmail.com> wrote:
> tried casting to text,varchar but no luck
> select u.relid,c.relnamespace::regnamespace::text,c.relname,now() as
> current_time,pg_size_pretty(pg_relation_size(c.oid)) as
> current_size,pg_size_pretty(u.table_size) as
> previous_size,pg_size_pretty(pg_relation_size(c.oid) -
> pg_relation_size(u.table_size)) as diff from user_tables_sizes u join
> pg_class c on u.relid::varchar= c.oid::varchar where c.relkind='r' and
> c.relnamespace::regnamespace::text='rpx_reporting_stage' and
> u.captured_dt::date=current_date - interval '1 days'
> ;
>
>
> ERROR: OID out of range
>
>>
>>
Yeah, the join isn't the problem, the error is casting to OID, not from...
Pretty sure your problem is:
pg_relation_size(u.table_size)
David J.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: OID out of range
@ 2020-01-15 19:23 Rob Sargent <robjsargent@gmail.com>
parent: Konireddy Rajashekar <rajkonireddy@gmail.com>
0 siblings, 0 replies; 9+ messages in thread
From: Rob Sargent @ 2020-01-15 19:23 UTC (permalink / raw)
To: Konireddy Rajashekar <rajkonireddy@gmail.com>; +Cc: Alvaro Herrera <alvherre@2ndquadrant.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
> On Jan 15, 2020, at 12:17 PM, Konireddy Rajashekar <rajkonireddy@gmail.com> wrote:
>
> @Alvaro Herrera, Can i alter the datatype of relid to oid and try ?
>
Not if Alvaro’s theory is correct. List that column, check for nulls, values greater the 2^32.
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2020-01-15 19:23 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 18:18 OID out of range Konireddy Rajashekar <rajkonireddy@gmail.com>
2020-01-15 18:29 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-01-15 18:36 ` bhargav kamineni <bhargavpostgres@gmail.com>
2020-01-15 18:42 ` David G. Johnston <david.g.johnston@gmail.com>
2020-01-15 19:00 ` Konireddy Rajashekar <rajkonireddy@gmail.com>
2020-01-15 19:20 ` David G. Johnston <david.g.johnston@gmail.com>
2020-01-15 19:11 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2020-01-15 19:17 ` Konireddy Rajashekar <rajkonireddy@gmail.com>
2020-01-15 19:23 ` Rob Sargent <robjsargent@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox