使用spring-boot拒绝创建pg_catalog.sample_table的权限 [英] permission denied to create pg_catalog.sample_table using spring-boot

查看:131
本文介绍了使用spring-boot拒绝创建pg_catalog.sample_table的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Spring-boot,并在application.properties文件中配置了数据库,如下所示:

I'm using Spring-boot and configured database in application.properties file like below

spring.datasource.primary.url=jdbc:postgresql://localhost:5432/mydb
spring.datasource.primary.username=postgres
spring.datasource.primary.password=pass
spring.datasource.primary.driver-class-name=org.postgresql.Driver
spring.datasource.primary.maxActive=10
spring.datasource.primary.testWhileIdle = true
spring.datasource.primary.validationQuery = SELECT 1

spring.jpa.properties.hibernate.default-schema=public
spring.jpa.hibernate.ddl-auto:update

它在Windows中可以完美运行,但是当我在Mac中运行它时,它会显示一些错误,并且无法创建表格

It works perfect in windows, but when I run it in Mac it shows some errors and does not create table

[ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000388: Unsuccessful:
    create table sample_table (table_id  serial not null, name varchar(255))
2017-07-07 10:52:51.145 ERROR 1446 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaUpdate  :
    ERROR: permission denied to create "pg_catalog.sample_table"
Detail: System catalog modifications are currently disallowed.

我尝试了以下方法来解决问题

I tried below things to resolve the issue

  • 通过将属性中的默认架构更改为其他内容.

  • By changing default schema in properties to something else.

通过将ddl-auto更改为createcreate-dropnone.

但没有成功.

我不知道为什么要尝试在pg_catalog模式中创建表?

I don't know why it is trying to create table in pg_catalog schema?

推荐答案

我已通过更改application.properties文件的下一行来解决它

I've solved it by changing below line from application.properties file

spring.jpa.properties.hibernate.default-schema=public

spring.jpa.properties.hibernate.default_schema=public

它奏效了.

这篇关于使用spring-boot拒绝创建pg_catalog.sample_table的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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