1
テーブル内のカラムを宣言するのに最適なデータ型は、postgresqlに数字ではなく文字のみを含むことができますか?postgresqlの文字(非数字)を持つカラムのデータ型
テーブル内のカラムを宣言するのに最適なデータ型は、postgresqlに数字ではなく文字のみを含むことができますか?postgresqlの文字(非数字)を持つカラムのデータ型
チェック制約を持つvarcharでドメインを作成することをお勧めします。
create domain textonly text check (value not similar to '%[0-9]%');
次に、数字を防ぐデータ型として使用できます。
pagetest=# create table dtest (test textonly);
CREATE TABLE
pagetest=# insert into dtest values ('abc');
INSERT 0 1
pagetest=# insert into dtest values ('ab2c');
ERROR: value for domain textonly violates check constraint "textonly_check"
pagetest=#
ありがとうございました。あなたの答えの少し変更がトリックでした。 –