我正在用这个脚本创建schema / db / ...:
CREATE ROLE testuser LOGIN PASSWORD 'password';
CREATE TABLESPACE testtablespace OWNER testuser LOCATION '/pgdata/pg94/testtablespace';
CREATE SCHEMA testschema;
ALTER SCHEMA testschema OWNER TO testuser;
CREATE DATABASE testdb WITH TABLESPACE testtablespace ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0 OWNER testuser;
ALTER DATABASE testdb SET search_path TO testschema, public;
ALTER ROLE testuser SET search_path TO testschema, public;
GRANT ALL ON DATABASE testdb TO testuser;
GRANT ALL ON SCHEMA testschema TO testuser;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA testschema TO testuser;
ALTER ROLE testuser SET default_tablespace = testtablespace;
当我使用命令psql -U testuser testdb
登录并执行命令select schema_name from information_schema.schemata ;
时。更糟糕的是我无法在此架构中创建表
testdb=> create table testschema.test (test varchar(10));
ERROR: schema "testschema" does not exist
请问我应该配置什么来查看模式并在int中创建表?
答案 0 :(得分:1)
pixelsPerLabel
始终适用于当前数据库。您已在当前数据库中创建CREATE SCHEMA
(可能是testschema
),而不是postgres
。
您应该连接到testdb
,然后创建新的模式。