Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql INSERT的表达式多于目标列_Sql_Postgresql - Fatal编程技术网

Sql INSERT的表达式多于目标列

Sql INSERT的表达式多于目标列,sql,postgresql,Sql,Postgresql,我试图在postgreSQL中将所有数据从一个表插入到另一个表中,但不知道为什么我一直遇到这个错误。有人能帮忙吗 错误: ERROR: INSERT has more expressions than target columns LINE 3: select * from data 执行插入操作时,请始终列出insert和select的列。这个问题会消失,你的代码会更安全、更清晰。谢谢,但是我所附的MySQL链接使用了代码片段中的*。*在postgreSQL中是否可能?只要两个表具有相同

我试图在postgreSQL中将所有数据从一个表插入到另一个表中,但不知道为什么我一直遇到这个错误。有人能帮忙吗

错误:

ERROR:  INSERT has more expressions than target columns
LINE 3: select * from data

执行插入操作时,请始终列出
insert
select
的列。这个问题会消失,你的代码会更安全、更清晰。谢谢,但是我所附的MySQL链接使用了代码片段中的*。*在postgreSQL中是否可能?只要两个表具有相同的数据结构,就有可能。话虽如此,为什么不简单地在数据中添加一个名为status的新列,或者类似的东西呢。这正是星号的原因。如果两个表具有相同的数据结构,您将不会收到该错误消息。
ERROR:  INSERT has more expressions than target columns
LINE 3: select * from data