0
我有两个表:第一个表有7列。第二个表customer_campaign
的列数多于第一个表的id(uuid type)
作为主键。由于id
的类型为not-null constant
,当我执行以下查询:“列中的空值...违反非空约束”与INSERT INTO ... SELECT
INSERT INTO customer_campaign (store_name, store_address, store_city, store_province,
store_postal_code, lat, long)
SELECT * FROM customer_campaign_import;
它返回一个错误:
ERROR: null value in column "id" violates not-null constraint
插入时,第一个表的每一行如何生成一个唯一的id
第一张桌子放入第二张桌子?
将您的ID设置为使用序列自动递增。更多阅读[这里] [1]。 [1]:http://stackoverflow.com/questions/9490014/adding-serial-to-existing-column-in-postgres – Carlo 2014-10-02 19:41:11