objsubid vs subobjid
pg_get_object_address() currently returns a field called subobjid, while
pg_depend calls that objsubid. I'm guessing that wasn't on purpose
(especially because internally the function uses objsubid), and it'd be
nice to fix it.
Attached does that, as well as updating the input naming on the other
functions for consistency. I stopped short of changing the instances of
subobjid in the C code to reduce backpatch issues, but maybe that should
be done too...
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)
Attachments:
subobjid_objsubid.patchtext/plain; charset=UTF-8; name=subobjid_objsubid.patch; x-mac-creator=0; x-mac-type=0Download
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 05652e86c2..5233089d87 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -3096,13 +3096,13 @@ DESCR("get transaction Id and commit timestamp of latest transaction commit");
DATA(insert OID = 3537 ( pg_describe_object PGNSP PGUID 12 1 0 0 0 f f f f t f s s 3 0 25 "26 26 23" _null_ _null_ _null_ _null_ _null_ pg_describe_object _null_ _null_ _null_ ));
DESCR("get identification of SQL object");
-DATA(insert OID = 3839 ( pg_identify_object PGNSP PGUID 12 1 0 0 0 f f f f t f s s 3 0 2249 "26 26 23" "{26,26,23,25,25,25,25}" "{i,i,i,o,o,o,o}" "{classid,objid,subobjid,type,schema,name,identity}" _null_ _null_ pg_identify_object _null_ _null_ _null_ ));
+DATA(insert OID = 3839 ( pg_identify_object PGNSP PGUID 12 1 0 0 0 f f f f t f s s 3 0 2249 "26 26 23" "{26,26,23,25,25,25,25}" "{i,i,i,o,o,o,o}" "{classid,objid,objsubid,type,schema,name,identity}" _null_ _null_ pg_identify_object _null_ _null_ _null_ ));
DESCR("get machine-parseable identification of SQL object");
-DATA(insert OID = 3382 ( pg_identify_object_as_address PGNSP PGUID 12 1 0 0 0 f f f f t f s s 3 0 2249 "26 26 23" "{26,26,23,25,1009,1009}" "{i,i,i,o,o,o}" "{classid,objid,subobjid,type,object_names,object_args}" _null_ _null_ pg_identify_object_as_address _null_ _null_ _null_ ));
+DATA(insert OID = 3382 ( pg_identify_object_as_address PGNSP PGUID 12 1 0 0 0 f f f f t f s s 3 0 2249 "26 26 23" "{26,26,23,25,1009,1009}" "{i,i,i,o,o,o}" "{classid,objid,objsubid,type,object_names,object_args}" _null_ _null_ pg_identify_object_as_address _null_ _null_ _null_ ));
DESCR("get identification of SQL object for pg_get_object_address()");
-DATA(insert OID = 3954 ( pg_get_object_address PGNSP PGUID 12 1 0 0 0 f f f f t f s s 3 0 2249 "25 1009 1009" "{25,1009,1009,26,26,23}" "{i,i,i,o,o,o}" "{type,name,args,classid,objid,subobjid}" _null_ _null_ pg_get_object_address _null_ _null_ _null_ ));
+DATA(insert OID = 3954 ( pg_get_object_address PGNSP PGUID 12 1 0 0 0 f f f f t f s s 3 0 2249 "25 1009 1009" "{25,1009,1009,26,26,23}" "{i,i,i,o,o,o}" "{type,name,args,classid,objid,objsubid}" _null_ _null_ pg_get_object_address _null_ _null_ _null_ ));
DESCR("get OID-based object address from name/args arrays");
DATA(insert OID = 2079 ( pg_table_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ pg_table_is_visible _null_ _null_ _null_ ));
diff --git a/src/test/regress/expected/object_address.out b/src/test/regress/expected/object_address.out
index ec5ada97ad..08f9826c9e 100644
--- a/src/test/regress/expected/object_address.out
+++ b/src/test/regress/expected/object_address.out
@@ -401,14 +401,14 @@ WITH objects (type, name, args) AS (VALUES
('publication relation', '{addr_nsp, gentable}', '{addr_pub}'),
('subscription', '{addr_sub}', '{}')
)
-SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.subobjid)).*,
+SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
-- test roundtrip through pg_identify_object_as_address
- ROW(pg_identify_object(addr1.classid, addr1.objid, addr1.subobjid)) =
- ROW(pg_identify_object(addr2.classid, addr2.objid, addr2.subobjid))
+ ROW(pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)) =
+ ROW(pg_identify_object(addr2.classid, addr2.objid, addr2.objsubid))
FROM objects, pg_get_object_address(type, name, args) addr1,
- pg_identify_object_as_address(classid, objid, subobjid) ioa(typ,nms,args),
+ pg_identify_object_as_address(classid, objid, objsubid) ioa(typ,nms,args),
pg_get_object_address(typ, nms, ioa.args) as addr2
- ORDER BY addr1.classid, addr1.objid, addr1.subobjid;
+ ORDER BY addr1.classid, addr1.objid, addr1.objsubid;
type | schema | name | identity | ?column?
---------------------------+------------+-------------------+----------------------------------------------------------------------+----------
default acl | | | for role regress_addr_user in schema public on tables | t
diff --git a/src/test/regress/sql/object_address.sql b/src/test/regress/sql/object_address.sql
index e658ea346d..0ace4dd425 100644
--- a/src/test/regress/sql/object_address.sql
+++ b/src/test/regress/sql/object_address.sql
@@ -181,14 +181,14 @@ WITH objects (type, name, args) AS (VALUES
('publication relation', '{addr_nsp, gentable}', '{addr_pub}'),
('subscription', '{addr_sub}', '{}')
)
-SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.subobjid)).*,
+SELECT (pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)).*,
-- test roundtrip through pg_identify_object_as_address
- ROW(pg_identify_object(addr1.classid, addr1.objid, addr1.subobjid)) =
- ROW(pg_identify_object(addr2.classid, addr2.objid, addr2.subobjid))
+ ROW(pg_identify_object(addr1.classid, addr1.objid, addr1.objsubid)) =
+ ROW(pg_identify_object(addr2.classid, addr2.objid, addr2.objsubid))
FROM objects, pg_get_object_address(type, name, args) addr1,
- pg_identify_object_as_address(classid, objid, subobjid) ioa(typ,nms,args),
+ pg_identify_object_as_address(classid, objid, objsubid) ioa(typ,nms,args),
pg_get_object_address(typ, nms, ioa.args) as addr2
- ORDER BY addr1.classid, addr1.objid, addr1.subobjid;
+ ORDER BY addr1.classid, addr1.objid, addr1.objsubid;
---
--- Cleanup resources
On 2/22/17 19:35, Jim Nasby wrote:
pg_get_object_address() currently returns a field called subobjid, while
pg_depend calls that objsubid. I'm guessing that wasn't on purpose
(especially because internally the function uses objsubid), and it'd be
nice to fix it.
I'm in favor of changing it, but it could theoretically break someone's
code. I don't know what the practical use for these functions is.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Peter Eisentraut wrote:
On 2/22/17 19:35, Jim Nasby wrote:
pg_get_object_address() currently returns a field called subobjid, while
pg_depend calls that objsubid. I'm guessing that wasn't on purpose
(especially because internally the function uses objsubid), and it'd be
nice to fix it.I'm in favor of changing it, but it could theoretically break someone's
code.
Yes, it was an oversight. +1 for changing.
I don't know what the practical use for these functions is.
This was originally written for BDR use in DDL replication. Partly the
interfaces exist for testing purposes (to make sure that object
addresses can roundtrip between internal OID numerical representation
and set of names); what BDR uses is the path that goes via event
triggers (pg_event_trigger_ddl_commands and pg_event_trigger_dropped_objects).
I didn't find any use of the name "subobjid" anywhere in BDR.
--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 3/1/17 09:51, Alvaro Herrera wrote:
Peter Eisentraut wrote:
On 2/22/17 19:35, Jim Nasby wrote:
pg_get_object_address() currently returns a field called subobjid, while
pg_depend calls that objsubid. I'm guessing that wasn't on purpose
(especially because internally the function uses objsubid), and it'd be
nice to fix it.I'm in favor of changing it, but it could theoretically break someone's
code.Yes, it was an oversight. +1 for changing.
OK done.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 3/1/17 9:24 AM, Peter Eisentraut wrote:
On 3/1/17 09:51, Alvaro Herrera wrote:
Peter Eisentraut wrote:
On 2/22/17 19:35, Jim Nasby wrote:
pg_get_object_address() currently returns a field called subobjid, while
pg_depend calls that objsubid. I'm guessing that wasn't on purpose
(especially because internally the function uses objsubid), and it'd be
nice to fix it.I'm in favor of changing it, but it could theoretically break someone's
code.Yes, it was an oversight. +1 for changing.
OK done.
BTW, did you backpatch as well? The function was added in 9.5.
Presumably we wouldn't normally do that, but if we think this is unused
enough maybe it's worth it.
--
Jim Nasby, Chief Data Architect, OpenSCG
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 3/5/17 16:10, Jim Nasby wrote:
BTW, did you backpatch as well? The function was added in 9.5.
Presumably we wouldn't normally do that, but if we think this is unused
enough maybe it's worth it.
It's a catalog change, so we can't backpatch it.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers