mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Improve English wording of some other getObjectDescription() messages.
Print columns as "column C of <relation>" rather than "<relation> column C". This seems to read noticeably better in English, as evidenced by the regression test output changes, and the code change also makes it possible for translators to adjust the phrase order in other languages. Also change the output for OCLASS_DEFAULT from "default for %s" to "default value for %s". This seems to read better and is also more consistent with the output of, for instance, getObjectTypeDescription(). Kyotaro Horiguchi, per a complaint from me Discussion: https://postgr.es/m/20180522.182020.114074746.horiguchi.kyotaro@lab.ntt.co.jp
This commit is contained in:
@ -985,7 +985,7 @@ HINT: You can drop extension cube instead.
|
|||||||
create table foo (f1 cube, f2 int);
|
create table foo (f1 cube, f2 int);
|
||||||
drop extension cube; -- fail, foo.f1 requires it
|
drop extension cube; -- fail, foo.f1 requires it
|
||||||
ERROR: cannot drop extension cube because other objects depend on it
|
ERROR: cannot drop extension cube because other objects depend on it
|
||||||
DETAIL: table foo column f1 depends on type cube
|
DETAIL: column f1 of table foo depends on type cube
|
||||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||||
drop table foo;
|
drop table foo;
|
||||||
drop extension cube;
|
drop extension cube;
|
||||||
@ -1039,15 +1039,15 @@ create extension cube with schema c;
|
|||||||
create table foo (f1 c.cube, f2 int);
|
create table foo (f1 c.cube, f2 int);
|
||||||
drop extension cube; -- fail, foo.f1 requires it
|
drop extension cube; -- fail, foo.f1 requires it
|
||||||
ERROR: cannot drop extension cube because other objects depend on it
|
ERROR: cannot drop extension cube because other objects depend on it
|
||||||
DETAIL: table foo column f1 depends on type c.cube
|
DETAIL: column f1 of table foo depends on type c.cube
|
||||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||||
drop schema c; -- fail, cube requires it
|
drop schema c; -- fail, cube requires it
|
||||||
ERROR: cannot drop schema c because other objects depend on it
|
ERROR: cannot drop schema c because other objects depend on it
|
||||||
DETAIL: extension cube depends on schema c
|
DETAIL: extension cube depends on schema c
|
||||||
table foo column f1 depends on type c.cube
|
column f1 of table foo depends on type c.cube
|
||||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||||
drop extension cube cascade;
|
drop extension cube cascade;
|
||||||
NOTICE: drop cascades to table foo column f1
|
NOTICE: drop cascades to column f1 of table foo
|
||||||
\d foo
|
\d foo
|
||||||
Table "public.foo"
|
Table "public.foo"
|
||||||
Column | Type | Collation | Nullable | Default
|
Column | Type | Collation | Nullable | Default
|
||||||
|
@ -8116,7 +8116,7 @@ CREATE TABLE import_source.t5 (c1 int, c2 text collate "C", "Col" "Colors");
|
|||||||
CREATE SCHEMA import_dest5;
|
CREATE SCHEMA import_dest5;
|
||||||
BEGIN;
|
BEGIN;
|
||||||
DROP TYPE "Colors" CASCADE;
|
DROP TYPE "Colors" CASCADE;
|
||||||
NOTICE: drop cascades to table import_source.t5 column Col
|
NOTICE: drop cascades to column Col of table import_source.t5
|
||||||
IMPORT FOREIGN SCHEMA import_source LIMIT TO (t5)
|
IMPORT FOREIGN SCHEMA import_source LIMIT TO (t5)
|
||||||
FROM SERVER loopback INTO import_dest5; -- ERROR
|
FROM SERVER loopback INTO import_dest5; -- ERROR
|
||||||
ERROR: type "public.Colors" does not exist
|
ERROR: type "public.Colors" does not exist
|
||||||
|
@ -2681,12 +2681,23 @@ getObjectDescription(const ObjectAddress *object)
|
|||||||
switch (getObjectClass(object))
|
switch (getObjectClass(object))
|
||||||
{
|
{
|
||||||
case OCLASS_CLASS:
|
case OCLASS_CLASS:
|
||||||
getRelationDescription(&buffer, object->objectId);
|
if (object->objectSubId == 0)
|
||||||
if (object->objectSubId != 0)
|
getRelationDescription(&buffer, object->objectId);
|
||||||
appendStringInfo(&buffer, _(" column %s"),
|
else
|
||||||
|
{
|
||||||
|
/* column, not whole relation */
|
||||||
|
StringInfoData rel;
|
||||||
|
|
||||||
|
initStringInfo(&rel);
|
||||||
|
getRelationDescription(&rel, object->objectId);
|
||||||
|
/* translator: second %s is, e.g., "table %s" */
|
||||||
|
appendStringInfo(&buffer, _("column %s of %s"),
|
||||||
get_attname(object->objectId,
|
get_attname(object->objectId,
|
||||||
object->objectSubId,
|
object->objectSubId,
|
||||||
false));
|
false),
|
||||||
|
rel.data);
|
||||||
|
pfree(rel.data);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_PROC:
|
case OCLASS_PROC:
|
||||||
@ -2850,7 +2861,8 @@ getObjectDescription(const ObjectAddress *object)
|
|||||||
colobject.objectId = attrdef->adrelid;
|
colobject.objectId = attrdef->adrelid;
|
||||||
colobject.objectSubId = attrdef->adnum;
|
colobject.objectSubId = attrdef->adnum;
|
||||||
|
|
||||||
appendStringInfo(&buffer, _("default for %s"),
|
/* translator: %s is typically "column %s of table %s" */
|
||||||
|
appendStringInfo(&buffer, _("default value for %s"),
|
||||||
getObjectDescription(&colobject));
|
getObjectDescription(&colobject));
|
||||||
|
|
||||||
systable_endscan(adscan);
|
systable_endscan(adscan);
|
||||||
|
@ -1844,7 +1844,7 @@ select * from foo;
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
drop domain mytype cascade;
|
drop domain mytype cascade;
|
||||||
NOTICE: drop cascades to table foo column f2
|
NOTICE: drop cascades to column f2 of table foo
|
||||||
select * from foo;
|
select * from foo;
|
||||||
f1 | f3
|
f1 | f3
|
||||||
----+----
|
----+----
|
||||||
@ -2870,8 +2870,8 @@ DROP TABLE test_tbl2_subclass;
|
|||||||
CREATE TYPE test_typex AS (a int, b text);
|
CREATE TYPE test_typex AS (a int, b text);
|
||||||
CREATE TABLE test_tblx (x int, y test_typex check ((y).a > 0));
|
CREATE TABLE test_tblx (x int, y test_typex check ((y).a > 0));
|
||||||
ALTER TYPE test_typex DROP ATTRIBUTE a; -- fails
|
ALTER TYPE test_typex DROP ATTRIBUTE a; -- fails
|
||||||
ERROR: cannot drop composite type test_typex column a because other objects depend on it
|
ERROR: cannot drop column a of composite type test_typex because other objects depend on it
|
||||||
DETAIL: constraint test_tblx_y_check on table test_tblx depends on composite type test_typex column a
|
DETAIL: constraint test_tblx_y_check on table test_tblx depends on column a of composite type test_typex
|
||||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||||
ALTER TYPE test_typex DROP ATTRIBUTE a CASCADE;
|
ALTER TYPE test_typex DROP ATTRIBUTE a CASCADE;
|
||||||
NOTICE: drop cascades to constraint test_tblx_y_check on table test_tblx
|
NOTICE: drop cascades to constraint test_tblx_y_check on table test_tblx
|
||||||
|
@ -631,7 +631,7 @@ DROP COLLATION mycoll1;
|
|||||||
CREATE TABLE collate_test23 (f1 text collate mycoll2);
|
CREATE TABLE collate_test23 (f1 text collate mycoll2);
|
||||||
DROP COLLATION mycoll2; -- fail
|
DROP COLLATION mycoll2; -- fail
|
||||||
ERROR: cannot drop collation mycoll2 because other objects depend on it
|
ERROR: cannot drop collation mycoll2 because other objects depend on it
|
||||||
DETAIL: table collate_test23 column f1 depends on collation mycoll2
|
DETAIL: column f1 of table collate_test23 depends on collation mycoll2
|
||||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||||
-- invalid: non-lowercase quoted identifiers
|
-- invalid: non-lowercase quoted identifiers
|
||||||
CREATE COLLATION case_coll ("Lc_Collate" = "POSIX", "Lc_Ctype" = "POSIX");
|
CREATE COLLATION case_coll ("Lc_Collate" = "POSIX", "Lc_Ctype" = "POSIX");
|
||||||
|
@ -298,8 +298,8 @@ ERROR: operator does not exist: character varying > double precision
|
|||||||
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
|
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
|
||||||
alter type comptype alter attribute r type bigint;
|
alter type comptype alter attribute r type bigint;
|
||||||
alter type comptype drop attribute r; -- fail
|
alter type comptype drop attribute r; -- fail
|
||||||
ERROR: cannot drop composite type comptype column r because other objects depend on it
|
ERROR: cannot drop column r of composite type comptype because other objects depend on it
|
||||||
DETAIL: constraint c1 depends on composite type comptype column r
|
DETAIL: constraint c1 depends on column r of composite type comptype
|
||||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||||
alter type comptype drop attribute i;
|
alter type comptype drop attribute i;
|
||||||
select conname, obj_description(oid, 'pg_constraint') from pg_constraint
|
select conname, obj_description(oid, 'pg_constraint') from pg_constraint
|
||||||
@ -645,8 +645,8 @@ alter domain dnotnulltest drop not null;
|
|||||||
update domnotnull set col1 = null;
|
update domnotnull set col1 = null;
|
||||||
drop domain dnotnulltest cascade;
|
drop domain dnotnulltest cascade;
|
||||||
NOTICE: drop cascades to 2 other objects
|
NOTICE: drop cascades to 2 other objects
|
||||||
DETAIL: drop cascades to table domnotnull column col1
|
DETAIL: drop cascades to column col1 of table domnotnull
|
||||||
drop cascades to table domnotnull column col2
|
drop cascades to column col2 of table domnotnull
|
||||||
-- Test ALTER DOMAIN .. DEFAULT ..
|
-- Test ALTER DOMAIN .. DEFAULT ..
|
||||||
create table domdeftest (col1 ddef1);
|
create table domdeftest (col1 ddef1);
|
||||||
insert into domdeftest default values;
|
insert into domdeftest default values;
|
||||||
|
@ -293,11 +293,11 @@ CREATE TEMP TABLE t1 (
|
|||||||
-- Both drops should fail, but with different error messages:
|
-- Both drops should fail, but with different error messages:
|
||||||
DROP SEQUENCE t1_f1_seq;
|
DROP SEQUENCE t1_f1_seq;
|
||||||
ERROR: cannot drop sequence t1_f1_seq because other objects depend on it
|
ERROR: cannot drop sequence t1_f1_seq because other objects depend on it
|
||||||
DETAIL: default for table t1 column f1 depends on sequence t1_f1_seq
|
DETAIL: default value for column f1 of table t1 depends on sequence t1_f1_seq
|
||||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||||
DROP SEQUENCE myseq2;
|
DROP SEQUENCE myseq2;
|
||||||
ERROR: cannot drop sequence myseq2 because other objects depend on it
|
ERROR: cannot drop sequence myseq2 because other objects depend on it
|
||||||
DETAIL: default for table t1 column f2 depends on sequence myseq2
|
DETAIL: default value for column f2 of table t1 depends on sequence myseq2
|
||||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||||
-- This however will work:
|
-- This however will work:
|
||||||
DROP SEQUENCE myseq3;
|
DROP SEQUENCE myseq3;
|
||||||
|
@ -557,10 +557,10 @@ LINE 2: FOR EACH STATEMENT WHEN (OLD.* IS DISTINCT FROM NEW.*)
|
|||||||
^
|
^
|
||||||
-- check dependency restrictions
|
-- check dependency restrictions
|
||||||
ALTER TABLE main_table DROP COLUMN b;
|
ALTER TABLE main_table DROP COLUMN b;
|
||||||
ERROR: cannot drop table main_table column b because other objects depend on it
|
ERROR: cannot drop column b of table main_table because other objects depend on it
|
||||||
DETAIL: trigger after_upd_b_row_trig on table main_table depends on table main_table column b
|
DETAIL: trigger after_upd_b_row_trig on table main_table depends on column b of table main_table
|
||||||
trigger after_upd_a_b_row_trig on table main_table depends on table main_table column b
|
trigger after_upd_a_b_row_trig on table main_table depends on column b of table main_table
|
||||||
trigger after_upd_b_stmt_trig on table main_table depends on table main_table column b
|
trigger after_upd_b_stmt_trig on table main_table depends on column b of table main_table
|
||||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||||
-- this should succeed, but we'll roll it back to keep the triggers around
|
-- this should succeed, but we'll roll it back to keep the triggers around
|
||||||
begin;
|
begin;
|
||||||
|
Reference in New Issue
Block a user