错误:无法在只读事务中执行 CREATE TABLE [英] ERROR: cannot execute CREATE TABLE in a read-only transaction

查看:110
本文介绍了错误:无法在只读事务中执行 CREATE TABLE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在本地计算机中设置 pgexercises 数据.当我运行时: psql -U -f clubdata.sql -d postgres -x 我收到错误:psql:clubdata.sql:6: ERROR: cannot execute CREATE SCHEMA in a read-only transaction.

I'm trying to setup the pgexercises data in my local machine. When I run: psql -U <username> -f clubdata.sql -d postgres -x I get the error: psql:clubdata.sql:6: ERROR: cannot execute CREATE SCHEMA in a read-only transaction.

为什么它会在我的本地机器上创建只读数据库?我可以改变这个吗?

Why did it create a read-only database on my local machine? Can I change this?

推荐答案

联系 pgexercises.com,他们能够帮助我.

Reached out to pgexercises.com and they were able to help me.

我运行了这些命令(单独):

I ran these commands(separately):

psql -U <username> -d postgres
begin;
set transaction read write;
alter database exercises set default_transaction_read_only = off;
commit;
\q

然后我从终端删除数据库 dropdb 练习 并再次运行脚本 psql -U -f clubdata.sql -d postgres -x -q

Then I dropped the database from the terminal dropdb exercises and ran script again psql -U <username> -f clubdata.sql -d postgres -x -q

这篇关于错误:无法在只读事务中执行 CREATE TABLE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆