pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedhow to insert row with specific oid
4+ messages / 3 participants
[nested] [flat]
* how to insert row with specific oid
@ 2020-06-19 07:02 ZongtianHou <zongtianhou@icloud.com>
0 siblings, 2 replies; 4+ messages in thread
From: ZongtianHou @ 2020-06-19 07:02 UTC (permalink / raw)
To: pgsql-admin
Hi, all
Could I insert a row to table with specific row oid. just like insert into tbl values (xx,xx) oid=xx? Is there some syntax to do this?
Best Regards,
Zongtian
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: how to insert row with specific oid
@ 2020-06-19 07:13 Laurenz Albe <laurenz.albe@cybertec.at>
parent: ZongtianHou <zongtianhou@icloud.com>
1 sibling, 1 reply; 4+ messages in thread
From: Laurenz Albe @ 2020-06-19 07:13 UTC (permalink / raw)
To: ZongtianHou <zongtianhou@icloud.com>; pgsql-admin
On Fri, 2020-06-19 at 15:02 +0800, ZongtianHou wrote:
> Could I insert a row to table with specific row oid. just like insert
> into tbl values (xx,xx) oid=xx? Is there some syntax to do this?
No, you cannot determine the OID that will be inserted.
Using tables WITH OIDS is deprecated, and the feature is gone in v12.
If you want to insert specific values, you shouldn't be using a
system-generated OID but a regular column of type "bigint" or so.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: how to insert row with specific oid
@ 2020-06-19 07:17 ZongtianHou <zongtianhou@icloud.com>
parent: Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 0 replies; 4+ messages in thread
From: ZongtianHou @ 2020-06-19 07:17 UTC (permalink / raw)
To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: pgsql-admin
Thank you for the detailed answer!
> On Jun 19, 2020, at 3:13 PM, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
>
> On Fri, 2020-06-19 at 15:02 +0800, ZongtianHou wrote:
>> Could I insert a row to table with specific row oid. just like insert
>> into tbl values (xx,xx) oid=xx? Is there some syntax to do this?
>
> No, you cannot determine the OID that will be inserted.
>
> Using tables WITH OIDS is deprecated, and the feature is gone in v12.
>
> If you want to insert specific values, you shouldn't be using a
> system-generated OID but a regular column of type "bigint" or so.
>
> Yours,
> Laurenz Albe
> --
> Cybertec | https://www.cybertec-postgresql.com
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: how to insert row with specific oid
@ 2020-06-19 14:14 Tom Lane <tgl@sss.pgh.pa.us>
parent: ZongtianHou <zongtianhou@icloud.com>
1 sibling, 0 replies; 4+ messages in thread
From: Tom Lane @ 2020-06-19 14:14 UTC (permalink / raw)
To: ZongtianHou <zongtianhou@icloud.com>; +Cc: pgsql-admin
ZongtianHou <zongtianhou@icloud.com> writes:
> Could I insert a row to table with specific row oid. just like insert into tbl values (xx,xx) oid=xx? Is there some syntax to do this?
Nope, at least not in PG versions that have special oid columns at all.
(Since v12, if you want an OID column, it's just a regular column.)
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2020-06-19 14:14 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-06-19 07:02 how to insert row with specific oid ZongtianHou <zongtianhou@icloud.com>
2020-06-19 07:13 ` Laurenz Albe <laurenz.albe@cybertec.at>
2020-06-19 07:17 ` ZongtianHou <zongtianhou@icloud.com>
2020-06-19 14:14 ` Tom Lane <tgl@sss.pgh.pa.us>
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