postgresql/src/backend/commands
Tom Lane 76a3df6e5e Code review focused on new node types added by partitioning support.
Fix failure to check that we got a plain Const from const-simplification of
a coercion request.  This is the cause of bug #14666 from Tian Bing: there
is an int4 to money cast, but it's only stable not immutable (because of
dependence on lc_monetary), resulting in a FuncExpr that the code was
miserably unequipped to deal with, or indeed even to notice that it was
failing to deal with.  Add test cases around this coercion behavior.

In view of the above, sprinkle the code liberally with castNode() macros,
in hope of catching the next such bug a bit sooner.  Also, change some
functions that were randomly declared to take Node* to take more specific
pointer types.  And change some struct fields that were declared Node*
but could be given more specific types, allowing removal of assorted
explicit casts.

Place PARTITION_MAX_KEYS check a bit closer to the code it's protecting.
Likewise check only-one-key-for-list-partitioning restriction in a less
random place.

Avoid not-per-project-style usages like !strcmp(...).

Fix assorted failures to avoid scribbling on the input of parse
transformation.  I'm not sure how necessary this is, but it's entirely
silly for these functions to be expending cycles to avoid that and not
getting it right.

Add guards against partitioning on system columns.

Put backend/nodes/ support code into an order that matches handling
of these node types elsewhere.

Annotate the fact that somebody added location fields to PartitionBoundSpec
and PartitionRangeDatum but forgot to handle them in
outfuncs.c/readfuncs.c.  This is fairly harmless for production purposes
(since readfuncs.c would just substitute -1 anyway) but it's still bogus.
It's not worth forcing a post-beta1 initdb just to fix this, but if we
have another reason to force initdb before 10.0, we should go back and
clean this up.

Contrariwise, somebody added location fields to PartitionElem and
PartitionSpec but forgot to teach exprLocation() about them.

Consolidate duplicative code in transformPartitionBound().

Improve a couple of error messages.

Improve assorted commentary.

Re-pgindent the files touched by this patch; this affects a few comment
blocks that must have been added quite recently.

Report: https://postgr.es/m/20170524024550.29935.14396@wrigleys.postgresql.org
2017-05-28 23:20:28 -04:00
..
Makefile Implement multivariate n-distinct coefficients 2017-03-24 14:06:10 -03:00
aggregatecmds.c Improve castNode notation by introducing list-extraction-specific variants. 2017-04-10 13:51:53 -04:00
alter.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
amcmds.c Fix typos in comments. 2017-02-06 11:33:58 +02:00
analyze.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
async.c Improve castNode notation by introducing list-extraction-specific variants. 2017-04-10 13:51:53 -04:00
cluster.c In rebuild_relation(), don't access an already-closed relcache entry. 2017-03-04 16:09:33 -05:00
collationcmds.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
comment.c Allow COMMENT ON COLUMN with partitioned tables 2017-04-18 10:42:10 +01:00
constraint.c Allow index AMs to cache data across aminsert calls within a SQL command. 2017-02-09 11:52:12 -05:00
conversioncmds.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
copy.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
createas.c Improve castNode notation by introducing list-extraction-specific variants. 2017-04-10 13:51:53 -04:00
dbcommands.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
define.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
discard.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
dropcmds.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
event_trigger.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
explain.c Improve castNode notation by introducing list-extraction-specific variants. 2017-04-10 13:51:53 -04:00
extension.c Ensure commands in extension scripts see the results of preceding DDL. 2017-05-02 18:06:09 -04:00
foreigncmds.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
functioncmds.c Improve castNode notation by introducing list-extraction-specific variants. 2017-04-10 13:51:53 -04:00
indexcmds.c Faster expression evaluation and targetlist projection. 2017-03-25 14:52:06 -07:00
lockcmds.c Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
matview.c Improve castNode notation by introducing list-extraction-specific variants. 2017-04-10 13:51:53 -04:00
opclasscmds.c Improve castNode notation by introducing list-extraction-specific variants. 2017-04-10 13:51:53 -04:00
operatorcmds.c Replace LookupFuncNameTypeNames() with LookupFuncWithArgs() 2017-03-06 13:31:47 -05:00
policy.c Provide CatalogTupleDelete() as a wrapper around simple_heap_delete(). 2017-02-01 16:13:30 -05:00
portalcmds.c Improve castNode notation by introducing list-extraction-specific variants. 2017-04-10 13:51:53 -04:00
prepare.c Improve castNode notation by introducing list-extraction-specific variants. 2017-04-10 13:51:53 -04:00
proclang.c Provide CatalogTupleDelete() as a wrapper around simple_heap_delete(). 2017-02-01 16:13:30 -05:00
publicationcmds.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
schemacmds.c Add infrastructure to support EphemeralNamedRelation references. 2017-03-31 23:17:18 -05:00
seclabel.c Remove objname/objargs split for referring to objects 2017-03-06 13:31:47 -05:00
sequence.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
statscmds.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
subscriptioncmds.c Fix mistake in error message 2017-05-19 16:30:02 -04:00
tablecmds.c Code review focused on new node types added by partitioning support. 2017-05-28 23:20:28 -04:00
tablespace.c Remove useless duplicate inclusions of system header files. 2017-02-25 16:12:55 -05:00
trigger.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
tsearchcmds.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
typecmds.c Remove objname/objargs split for referring to objects 2017-03-06 13:31:47 -05:00
user.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
vacuum.c Track the oldest XID that can be safely looked up in CLOG. 2017-03-23 14:26:31 -04:00
vacuumlazy.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00
variable.c Remove now-dead code for !HAVE_INT64_TIMESTAMP. 2017-02-23 14:04:43 -05:00
view.c Post-PG 10 beta1 pgindent run 2017-05-17 16:31:56 -04:00