![](/img/trans.png)
[英]Why is the "multiple default values" error when creating a postgresql table?
[英]PostgreSQL Table Multiple Values
所以我在postgreSQL中工作,我想創建一個表,並且在此表的一列中,我想要多個值作為布爾值。 例如:
create table if not exists x(
Numx numeric(5) PRIMARY KEY,
method (here for example I want method to be able to be something like this "method {a,b,c,d}"
);
因此方法可以具有a或b或a,b等值。
我該怎么做?
提前致謝
使用數組類型。
http://www.postgresql.org/docs/current/static/arrays.html
CREATE TABLE sal_emp (
name text,
pay_by_quarter integer[],
schedule text[][]
);
您可以在文檔中看到大量示例。 我個人只會在有數百個要存儲的情況下使用它們,對於一些布爾值,我可能會每個使用一個列或一個位掩碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.