postgres liquibase limit diff to one schema - postgresql

Goal:
I created a special login (named liquibase) which has only acces to one schema CustomerXX (the schema which I would like to compare and only this!!)
Problem:
Even with this login limited the liquibase diff operations try to read other schema (as exemple in my error obsolete_objects)
Remark:
I am studing the CustomerXX. I have another schema in the database named obsolete_objects but i am only focus on customerxx
login liquibase used ==>
GRANT all ON schema customerxx to liquibase;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA customerxx to liquibase;
no other right
My command liquibase:
liquibase.bat
--classpath="E:\Program Files\Talend-Studio\plugins\org.talend.libraries.jdbc.postgresql_5.5.1.r118616\lib\postgresql-9.2-1003.jdbc3.jar"
--driver=org.postgresql.Driver --url=jdbc:postgresql://xxxxxxxxx
--username=USERNAME
--password=PASSWORD
--defaultSchemaName=customerxx
Diff
--referenceUrl=jdbc:postgresql://yyyyyyyyyy
--referenceUsername=liquibase
--referencePassword=liquibase
--referenceDefaultSchemaName=customerxx
My error
Diff Results:
Unexpected error running Liquibase: liquibase.exception.DatabaseException:
org.postgresql.util.PSQLException: ERROR: permission denied for schema obsolete_objects PositionĂ¡: 27
Thanks in advance!

Related

ERROR: syntax error at or near "ALL" postgres GRANT psql 8.4.15

I have a postgresql version 8.4.15 database and when I want to give a user permissions on tables, I get a syntax error that in postgres version 11.5 it doesn't.
ERROR: syntax error at or near "ALL"
LINE 1: GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO consulta;
ERROR: syntax error at or near "ALL"
LINE 1: GRANT SELECT ON ALL TABLES IN SCHEMA public TO consulta;

ORA-01017: invalid username/password; logon denied on Pluggable database

I created a local user under a pluggable database. I granted some privileges required to open and use it. I check the username and the password. Still it keep saying invalid username/password.
Step that I take:
1. alter session set container = xxxxpdb
2. alter pluggable database xxxpdb open
3. SQL> alter user #### identified by #### container = current;
User altered. -----i did this one to make sure that i have a correct password
4. connect ###/####XXXXpdb;
ERROR:
ORA-01017: invalid username/password; logon denied
5. Then tried to connect to it this way
$ sqlplus ###/####xxxxpdb
ERROR:
ORA-01017: invalid username/password; logon denied
I am new to container database. I would appreciate any detailed explanation! Thank you.
Based on error message, it looks like the user doesn't exist in PDB.
For an existing user you may get a relevant error related to privilege. For example:
SQL> conn <existing_uname_without_required_privileges>/<upass>#<pdb_name>
ERROR:
ORA-01045: user <uname> lacks CREATE SESSION privilege; logon denied
Warning: You are no longer connected to ORACLE.
SQL>
For a non-existing user, the error you have observed will be returned:
SQL> conn <non_existing_user>/<upass>#<pdb_name>
ERROR:
ORA-01017: invalid username/password; logon denied
SQL>
This OraDoc Page provides the local user related information in CDB.

Permission denied after pg_upgrade on RDS

After trying to upgrade a shadow-copy of our PostgreSQL 9.6.6 RDS instance to 10.4, most operations on the database, including those done with a "root" user (the one created when setting up the database), result in an error like this:
SQL Error [42501]: ERROR: permission denied for schema public
Position: 15
Another example is a query like select * from example_table limit 100; which results in the error:
SQL Error [42P01]: ERROR: relation "example_table" does not exist
Position: 15
ERROR: relation "example_table" does not exist
Position: 15
ERROR: relation "example_table" does not exist
Position: 15
However, I am able to execute SELECT * FROM pg_catalog.pg_tables where schemaname = 'public'; which correctly lists all my tables
The upgrade logs don't seem to show anything unusual. I've been unable to find any RDS-specific instructions on upgrading from 9.x to 10.x so I assumed that the normal upgrade procedure in the interface (which I've used in the past and seems to be using a pg_upgrade operation) would "just work". Is there anything I'm missing?

Many syntax and permissions errors on postgres sql dump import

I am trying to import a .sql database dump into my postgres 9.6.1. I've tried in command line as well as the Postico GUI but get a ton of errors (like thousands of lines of errors) on import.
The SQL dump is from a coworker running postgres 9.4.5 and the SQL looks valid.
My Postgres Version:
PostgreSQL 9.6.1 on x86_64-apple-darwin, compiled by
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc.
build 5658) (LLVM build 2336.11.00), 64-bit
I've tried the following imports:
psql -U postgres dbname < ~/Desktop/dbname_local_db_20161122.sql
Then logging in and trying it:
psql -U postgres dbname
dbname=# \i ~/Desktop/dbname_local_db_20161122.sql
Errors: (there are way more than this)
Password for user postgres:
SET
SET
SET
SET
SET
SET
CREATE EXTENSION
COMMENT
ERROR: schema "public" does not exist
ERROR: extension "citext" does not exist
ERROR: schema "public" does not exist
ERROR: extension "pg_trgm" does not exist
SET
ERROR: function "add_session_metric" already exists with same argument types
ERROR: role "myrole" does not exist
ERROR: function "session_metrics_partition_creation" already exists with same argument types
ERROR: role "myrole" does not exist
ERROR: function "session_metrics_partition_function" already exists with same argument types
ERROR: role "myrole" does not exist
SET
SET
ERROR: permission denied to create "pg_catalog.messages"
DETAIL: System catalog modifications are currently disallowed.
ERROR: relation "messages" does not exist
ERROR: permission denied to create "pg_catalog.Message_id_seq"
DETAIL: System catalog modifications are currently disallowed.
ERROR: relation "Message_id_seq" does not exist
ERROR: relation "Message_id_seq" does not exist
ERROR: permission denied to create "pg_catalog.sessions_users"
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \N
invalid command \.
ERROR: syntax error at or near "2"
LINE 1: 2 hello 3 1 2015-11-12 09:25:14.646-07 2015-11-12 09:25:14.64...
ERROR: syntax error at or near "1"
LINE 1: 1
^
ERROR: relation "external_session_info_sessions" does not exist
invalid command \.
ERROR: syntax error at or near "2528"
LINE 1: 2528 1
^
invalid command \.
ERROR: relation "feedback_id_seq" does not exist
LINE 1: SELECT pg_catalog.setval('feedback_id_seq', 1, false);
Like I said, the SQL file looks valid. I've checked for compatibility issues from 9.4.5 to 9.6.1 but don't see any.
I do see PERMISSION DENIED but I am running the command as user postgres which has super user permissions:
First, the recommended way is to use pg_dump from the higher (target) database version to create the dump, because that version of pg_dump knows about incompatible changes that happened since and can create a dump that will restore correctly.
Some of the errors are normal if you restore a dump into a database that already has objects with the same names in it; often that is a sign that the dump should actually have been created with pg_dump -C to include a CREATE DATABASE statement.
However, your SQL script seems seriously messed up, and I doubt that it is an unmodified dump of a 9.4.5 database.
pg_dump will never dump any objects in pg_catalog. This schema can only contain system objects which are not included in a dump (they are created by CREATE DATABASE), and as you have seen, not even a superuser may create an object in that schema (unless allow_system_table_mods is on, which it really shouldn't be).

iReport Designer: permission denied for relation

I didn't face this error before. I have a database db, that contains a table tb_name, I create a connection in iReport Designer with credentials of the db owner. Then I create new report, but the query select * from tb_name; throws the following error:
SQL problems: ERROR: permission denied for relation tb_name
Query error
Message:
net.sf.jasperreports.engine.JRException: SQL problems: ERROR: permission denied for relation tb_name Level:
SEVERE Stack Trace: SQL problems: ERROR: permission denied for relation tb_name
com.jaspersoft.ireport.designer.data.fieldsproviders.SQLFieldsProvider.getFields(SQLFieldsProvider.java:435)
com.jaspersoft.ireport.designer.connection.JDBCConnection.readFields(JDBCConnection.java:470)
com.jaspersoft.ireport.designer.wizards.ConnectionSelectionWizardPanel.validate(ConnectionSelectionWizardPanel.java:146)
org.openide.WizardDescriptor$7.run(WizardDescriptor.java:1357)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
When I test connection everything's fine. What can be a reason of this error? Thanks in advance.
Please check if the user has rights to execute statements. Some database changes might have caused the user to lose query permission.