git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: b9734c1) | patch
Improve error messages about mismatching relkind
Thu, 8 Jul 2021 07:38:52 +0000 (09:38 +0200)
Thu, 8 Jul 2021 07:44:51 +0000 (09:44 +0200)
commit 2ed532ee8c474e9767e76e1f3251cc3a0224358c
Improve error messages about mismatching relkind

Most error messages about a relkind that was not supported or
appropriate for the command was of the pattern

"relation \"%s\" is not a table, foreign table, or materialized view"

This style can become verbose and tedious to maintain. Moreover, it's
not very helpful: If I'm trying to create a comment on a TOAST table,
which is not supported, then the information that I could have created
a comment on a materialized view is pointless.

Instead, write the primary error message shorter and saying more
directly that what was attempted is not possible. Then, in the detail
message, explain that the operation is not supported for the relkind
the object was. To simplify that, add a new function
errdetail_relkind_not_supported() that does this.

In passing, make use of RELKIND_HAS_STORAGE() where appropriate,
instead of listing out the relkinds individually.

Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://www.postgresql.org/message-id/flat/dc35a398-37d0-75ce-07ea-1dd71d98f8ec@2ndquadrant.com
32 files changed:
contrib/amcheck/expected/check_heap.out diff | blob | blame | history
contrib/amcheck/verify_heapam.c diff | blob | blame | history
contrib/pageinspect/expected/page.out diff | blob | blame | history
contrib/pageinspect/rawpage.c diff | blob | blame | history
contrib/pg_surgery/expected/heap_surgery.out diff | blob | blame | history
contrib/pg_surgery/heap_surgery.c diff | blob | blame | history
contrib/pg_visibility/expected/pg_visibility.out diff | blob | blame | history
contrib/pg_visibility/pg_visibility.c diff | blob | blame | history
contrib/pgstattuple/expected/pgstattuple.out diff | blob | blame | history
contrib/pgstattuple/pgstatapprox.c diff | blob | blame | history
contrib/pgstattuple/pgstatindex.c diff | blob | blame | history
contrib/pgstattuple/pgstattuple.c diff | blob | blame | history
src/backend/catalog/Makefile diff | blob | blame | history
src/backend/catalog/pg_class.c [new file with mode: 0644] blob
src/backend/catalog/toasting.c diff | blob | blame | history
src/backend/commands/comment.c diff | blob | blame | history
src/backend/commands/indexcmds.c diff | blob | blame | history
src/backend/commands/lockcmds.c diff | blob | blame | history
src/backend/commands/seclabel.c diff | blob | blame | history
src/backend/commands/sequence.c diff | blob | blame | history
src/backend/commands/statscmds.c diff | blob | blame | history
src/backend/commands/tablecmds.c diff | blob | blame | history
src/backend/commands/trigger.c diff | blob | blame | history
src/backend/parser/parse_utilcmd.c diff | blob | blame | history
src/backend/rewrite/rewriteDefine.c diff | blob | blame | history
src/include/catalog/pg_class.h diff | blob | blame | history
src/test/regress/expected/alter_table.out diff | blob | blame | history
src/test/regress/expected/create_table_like.out diff | blob | blame | history
src/test/regress/expected/foreign_data.out diff | blob | blame | history
src/test/regress/expected/indexing.out diff | blob | blame | history
src/test/regress/expected/sequence.out diff | blob | blame | history
src/test/regress/expected/stats_ext.out diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /