Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9f1255a

Browse files
committed
Don't zero opfuncid when reading nodes.
The comments here stated that this was just in case we ever had an ALTER OPERATOR command that could remap an operator to a different function. But those comments have been here for a long time, and no such command has come about. In the absence of such a feature, forcing the pg_proc OID to be looked up again each time we reread a stored rule or similar is just a waste of cycles. Moreover, parallel query needs a way to reread the exact same node tree that was written out, not one that has been slightly stomped on. So just get rid of this for now. Per discussion with Tom Lane.
1 parent 18d938d commit 9f1255a

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

src/backend/nodes/readfuncs.c

-44
Original file line numberDiff line numberDiff line change
@@ -665,17 +665,6 @@ _readOpExpr(void)
665665

666666
READ_OID_FIELD(opno);
667667
READ_OID_FIELD(opfuncid);
668-
669-
/*
670-
* The opfuncid is stored in the textual format primarily for debugging
671-
* and documentation reasons. We want to always read it as zero to force
672-
* it to be re-looked-up in the pg_operator entry. This ensures that
673-
* stored rules don't have hidden dependencies on operators' functions.
674-
* (We don't currently support an ALTER OPERATOR command, but might
675-
* someday.)
676-
*/
677-
local_node->opfuncid = InvalidOid;
678-
679668
READ_OID_FIELD(opresulttype);
680669
READ_BOOL_FIELD(opretset);
681670
READ_OID_FIELD(opcollid);
@@ -696,17 +685,6 @@ _readDistinctExpr(void)
696685

697686
READ_OID_FIELD(opno);
698687
READ_OID_FIELD(opfuncid);
699-
700-
/*
701-
* The opfuncid is stored in the textual format primarily for debugging
702-
* and documentation reasons. We want to always read it as zero to force
703-
* it to be re-looked-up in the pg_operator entry. This ensures that
704-
* stored rules don't have hidden dependencies on operators' functions.
705-
* (We don't currently support an ALTER OPERATOR command, but might
706-
* someday.)
707-
*/
708-
local_node->opfuncid = InvalidOid;
709-
710688
READ_OID_FIELD(opresulttype);
711689
READ_BOOL_FIELD(opretset);
712690
READ_OID_FIELD(opcollid);
@@ -727,17 +705,6 @@ _readNullIfExpr(void)
727705

728706
READ_OID_FIELD(opno);
729707
READ_OID_FIELD(opfuncid);
730-
731-
/*
732-
* The opfuncid is stored in the textual format primarily for debugging
733-
* and documentation reasons. We want to always read it as zero to force
734-
* it to be re-looked-up in the pg_operator entry. This ensures that
735-
* stored rules don't have hidden dependencies on operators' functions.
736-
* (We don't currently support an ALTER OPERATOR command, but might
737-
* someday.)
738-
*/
739-
local_node->opfuncid = InvalidOid;
740-
741708
READ_OID_FIELD(opresulttype);
742709
READ_BOOL_FIELD(opretset);
743710
READ_OID_FIELD(opcollid);
@@ -758,17 +725,6 @@ _readScalarArrayOpExpr(void)
758725

759726
READ_OID_FIELD(opno);
760727
READ_OID_FIELD(opfuncid);
761-
762-
/*
763-
* The opfuncid is stored in the textual format primarily for debugging
764-
* and documentation reasons. We want to always read it as zero to force
765-
* it to be re-looked-up in the pg_operator entry. This ensures that
766-
* stored rules don't have hidden dependencies on operators' functions.
767-
* (We don't currently support an ALTER OPERATOR command, but might
768-
* someday.)
769-
*/
770-
local_node->opfuncid = InvalidOid;
771-
772728
READ_BOOL_FIELD(useOr);
773729
READ_OID_FIELD(inputcollid);
774730
READ_NODE_FIELD(args);

0 commit comments

Comments
 (0)