Improve error messages

issue/6694
Gokhan Gulbiz 2023-03-29 09:12:24 +03:00
parent 529d7da33d
commit c893454bb8
No known key found for this signature in database
GPG Key ID: 608EF06B6BD1B45B
2 changed files with 12 additions and 6 deletions

View File

@ -3993,10 +3993,12 @@ ErrorIfTableHasUnsupportedIdentityColumn(Oid relationId)
if (attributeForm->attidentity && attributeForm->atttypid != INT8OID)
{
relation_close(relation, AccessShareLock);
char *qualifiedRelationName = generate_qualified_relation_name(relationId);
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg(
"cannot complete operation on a table with smallint/int identity column")));
"cannot complete operation on %s with smallint/int identity column", qualifiedRelationName),
errhint(
"Use bigint identity column instead.")));
}
}

View File

@ -21,9 +21,11 @@ CREATE TABLE smallint_identity_column (
a smallint GENERATED BY DEFAULT AS IDENTITY
);
SELECT create_distributed_table('smallint_identity_column', 'a');
ERROR: cannot complete operation on a table with smallint/int identity column
ERROR: cannot complete operation on generated_identities.smallint_identity_column with smallint/int identity column
HINT: Use bigint identity column instead.
SELECT create_distributed_table_concurrently('smallint_identity_column', 'a');
ERROR: cannot complete operation on a table with smallint/int identity column
ERROR: cannot complete operation on generated_identities.smallint_identity_column with smallint/int identity column
HINT: Use bigint identity column instead.
SELECT create_reference_table('smallint_identity_column');
ERROR: cannot complete operation on a table with identity column
SELECT citus_add_local_table_to_metadata('smallint_identity_column');
@ -38,9 +40,11 @@ CREATE TABLE int_identity_column (
a int GENERATED BY DEFAULT AS IDENTITY
);
SELECT create_distributed_table('int_identity_column', 'a');
ERROR: cannot complete operation on a table with smallint/int identity column
ERROR: cannot complete operation on generated_identities.int_identity_column with smallint/int identity column
HINT: Use bigint identity column instead.
SELECT create_distributed_table_concurrently('int_identity_column', 'a');
ERROR: cannot complete operation on a table with smallint/int identity column
ERROR: cannot complete operation on generated_identities.int_identity_column with smallint/int identity column
HINT: Use bigint identity column instead.
SELECT create_reference_table('int_identity_column');
ERROR: cannot complete operation on a table with identity column
SELECT citus_add_local_table_to_metadata('int_identity_column');