我试图在PostgreSQL中创建一个表,但它返回一个错误。 这是我的发言:
CREATE TABLE sportschema.zaal(
zaalnr serial PRIMARY KEY,
naam varchar(50),
adres varchar(50),
telefoonnummer varchar(50)
);
如果我执行此查询,则无法回复:
sportdb(#CREATE TABLE sportschema.zaal(zaalnr serial PRIMARY KEY, naam varchar(50),adres varchar(50),telefoonnummer varchar(50));
任何人都知道这个查询有什么问题吗?
在重新连接到数据库后尝试了几次后,它突然工作了:
sportdb = #CREATE TABLE sportschema.zaal(zaalnr serial PRIMARY KEY, naam varchar(50),adres varchar(50),telefoonnummer varchar(50));
创建表
sportdb =#
来自终端的样本:
portdb=# DROP TABLE sportschema.zaal;
DROP TABLE
sportdb=# CREATE TABLE sportschema.zaal(zaalnr serial PRIMARY KEY, naam varchar(50), adres varchar(50), telefoonnummer varchar(50);
sportdb(#
sportdb(#
//Inserted wrong query
sportdb(# CREATE TABLE sportschema.zaal(zaalnr serial PRIMARY KEY, naam varchar(50), adres varchar(50), telefoonnummer varchar(50);
//doing buggy after a wrong query
sportdb(# CREATE TABLE sportschema.zaal(zaalnr serial PRIMARY KEY, naam varchar(50), adres varchar(50), telefoonnummer varchar(50));
sportdb(# CREATE TABLE sportschema.zaal(zaalnr serial PRIMARY KEY, naam varchar(50), adres varchar(50), telefoonnummer varchar(50));
sportdb(# SELECT * FORM sportschema.zaal;
sportdb(# SELECT * FROM sportschema.zaal;
sportdb(# SELECT * FROM sportschema.zaal;
sportdb-# \q
postgres@bro:/home/foo$ psql -V
psql (PostgreSQL) 9.3.10
postgres=# \c sportdb
sportdb=# SELECT * FROM sportschema.zaal;
ERROR: relation "sportschema.zaal" does not exist
LINE 1: SELECT * FROM sportschema.zaal;
^
sportdb=# SELECT * FROM sportschema.zaal;
ERROR: relation "sportschema.zaal" does not exist
LINE 1: SELECT * FROM sportschema.zaal;
^
sportdb=# CREATE TABLE sportschema.zaal(zaalnr serial PRIMARY KEY, naam varchar(50), adres varchar(50), telefoonnummer varchar(50));
CREATE TABLE
sportdb=# SELECT * FROM sportschema.zaal;
zaalnr | naam | adres | telefoonnummer
--------+------+-------+----------------
(0 rows)
当我执行错误的查询时,我的SQL客户端在尝试执行下一个查询时表现得很奇怪。它通常会在之前给出我对查询的响应,而现在它只返回任何内容。 任何人都知道如何在插入错误的查询后解决postgresql的问题?