On Thu, Jun 24, 2021 at 10:12:49AM +0200, Peter Eisentraut wrote: > There might be room for some wordsmithing in a few places, but generally I > think this is complete.
I have been looking at that, and it seems to me that you nailed it. That's a nice improvement compared to the existing error handling with multiple relkinds. + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("ALTER action %s cannot be performed on relation \"%s\"", + action_str, RelationGetRelationName(rel)), + errdetail_relkind_not_supported(rel->rd_rel->relkind))); Perhaps the result of alter_table_type_to_string() is worth a note for translators? + case AT_DetachPartitionFinalize: + return "DETACH PARTITION FINALIZE"; To be exact, I think that this one should be "DETACH PARTITION ... FINALIZE". + if (relkind == RELKIND_INDEX || relkind == RELKIND_PARTITIONED_INDEX) + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("cannot change schema of index \"%s\"", + rv->relname), + errhint("Change the schema of the table instead."))); + else if (relkind == RELKIND_COMPOSITE_TYPE) + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("cannot change schema of composite type \"%s\"", + rv->relname), + errhint("Use ALTER TYPE instead."))); I would simplify this part by removing the errhint(), and use "cannot change schema of relation .." as error string, with a dose of errdetail_relkind_not_supported(). + errmsg("relation \"%s\" cannot have triggers", + RelationGetRelationName(rel)), Better as "cannot create/rename/remove triggers on relation \"%s\"" for the three code paths of trigger.c? + errmsg("relation \"%s\" cannot have rules", [...] + errmsg("relation \"%s\" cannot have rules", For rewriteDefine.c, this could be "cannot create/rename rules on relation". -- Michael
signature.asc
Description: PGP signature