{"action":"created","issue":{"url":"https://api.github.com/repos/liquibase/liquibase-postgresql/issues/3","repository_url":"https://api.github.com/repos/liquibase/liquibase-postgresql","labels_url":"https://api.github.com/repos/liquibase/liquibase-postgresql/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/liquibase/liquibase-postgresql/issues/3/comments","events_url":"https://api.github.com/repos/liquibase/liquibase-postgresql/issues/3/events","html_url":"https://github.com/liquibase/liquibase-postgresql/issues/3","id":196765705,"number":3,"title":"generateChangeLog - DatabaseException with liquibase.statement.core.GetViewDefinitionStatement","user":{"login":"MarkWojciechowicz","id":11320108,"avatar_url":"https://avatars.githubusercontent.com/u/11320108?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkWojciechowicz","html_url":"https://github.com/MarkWojciechowicz","followers_url":"https://api.github.com/users/MarkWojciechowicz/followers","following_url":"https://api.github.com/users/MarkWojciechowicz/following{/other_user}","gists_url":"https://api.github.com/users/MarkWojciechowicz/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkWojciechowicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkWojciechowicz/subscriptions","organizations_url":"https://api.github.com/users/MarkWojciechowicz/orgs","repos_url":"https://api.github.com/users/MarkWojciechowicz/repos","events_url":"https://api.github.com/users/MarkWojciechowicz/events{/privacy}","received_events_url":"https://api.github.com/users/MarkWojciechowicz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-20T19:56:29Z","updated_at":"2016-12-20T21:22:45Z","closed_at":"2016-12-20T21:22:45Z","body":"When running generateChangeLog against a postgres Database, the following error is encountered:\r\n\r\n_Unexpected error running Liquibase: liquibase.exception.DatabaseException: Error getting <my db url> view with liquibase.statement.core.GetViewDefinitionStatement@<some numbers>_\r\n\r\n**What is Probably Going on**\r\nUsing debug mode, I found that liquibase was trying to get the definition for a system view, \"all_synonyms.\"  However, it fails to retrieve the definition because it is filtering on my user schema:\r\n\r\n_select definition from pg_views where viewname='all_synonyms' AND schemaname='My Schema'_\r\n\r\nThis ultimately runs into the error: Caused by: liquibase.exception.DatabaseException: Empty result set, expected one row\r\n\r\nI added this view to my schema and it subsequently failed on a different system view, \"v$version.\"  I did this exercise for a while and it continued to fail trying to retrieve the definition for various new system views.  It appears that GetViewDefinitionStatement is iterating over all views, regardless of schema and that the target user schema needs to be filtered there.\r\n\r\n\r\n**Details from the debug:**\r\nliquibase --changeLogFile=changelog.initialize.xml --logLevel=DEBUG generateChangeLog\r\nliquibase.bat : DEBUG 12/20/16 9:36 AM: liquibase: Connected to <mydb>\r\nAt line:1 char:1\r\n+ & liquibase --changeLogFile=changelog.initialize.xml --logLevel=DEBUG generateCh ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (DEBUG 12/20/16 ...ntSchema=txpidv:String) [], RemoteException\r\n    + FullyQualifiedErrorId : NativeCommandError\r\n \r\nDEBUG 12/20/16 9:36 AM: liquibase: Setting auto commit to false from true\r\nWARNING 12/20/16 9:36 AM: liquibase: EnterpriseDB jdbc:<mydb> does not store DATE columns. \r\nAuto-converts them to TIMESTAMPs. (edb_redwood_date=true)\r\nDEBUG 12/20/16 9:36 AM: liquibase: Computed checksum for 1482244589438 as 24569be9b560c20ed0ebc723ff722c13\r\nDEBUG 12/20/16 9:36 AM: liquibase: Executing QUERY database command: SELECT c.relname AS SEQUENCE_NAME FROM pg_class c join pg_namespace on c.relnamespace = pg_namespace.oid WHERE c.relkind='S' AND nspname = 'null' AND c.oid \r\nnot in (select d.objid FROM pg_depend d where d.refobjsubid > 0)\r\nDEBUG 12/20/16 9:36 AM: liquibase: Executing QUERY database command: select definition from pg_views where viewname='all_synonyms' AND schemaname='My Schema'\r\nUnexpected error running Liquibase: liquibase.exception.DatabaseException: Error getting \r\njdbc:<mydb> view with liquibase.statement.core.GetViewDefinitionStatement@729d991e\r\nSEVERE 12/20/16 9:36 AM: liquibase: liquibase.exception.DatabaseException: Error getting \r\njdbc:<mydb> view with liquibase.statement.core.GetViewDefinitionStatement@729d991e\r\nliquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: Error getting \r\njdbc:<mydb> view with liquibase.statement.core.GetViewDefinitionStatement@729d991e\r\n    at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:265)\r\n    at liquibase.integration.commandline.Main.doMigration(Main.java:1011)\r\n    at liquibase.integration.commandline.Main.run(Main.java:188)\r\n    at liquibase.integration.commandline.Main.main(Main.java:103)\r\nCaused by: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: Error getting \r\njdbc:<mydb> view with liquibase.statement.core.GetViewDefinitionStatement@729d991e\r\n    at liquibase.command.AbstractCommand.execute(AbstractCommand.java:13)\r\n    at liquibase.integration.commandline.CommandLineUtils.doGenerateChangeLog(CommandLineUtils.java:263)\r\n    ... 3 more\r\nCaused by: liquibase.exception.DatabaseException: Error getting jdbc:<mydb> view with \r\nliquibase.statement.core.GetViewDefinitionStatement@729d991e\r\n    at liquibase.snapshot.jvm.ViewSnapshotGenerator.snapshotObject(ViewSnapshotGenerator.java:103)\r\n    at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:60)\r\n    at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)\r\n    at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:63)\r\n    at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)\r\n    at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:246)\r\n    at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:363)\r\n    at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:385)\r\n    at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:293)\r\n    at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:267)\r\n    at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:80)\r\n    at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:53)\r\n    at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:28)\r\n    at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:150)\r\n    at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:139)\r\n    at liquibase.command.DiffCommand.createReferenceSnapshot(DiffCommand.java:219)\r\n    at liquibase.command.DiffCommand.createDiffResult(DiffCommand.java:141)\r\n    at liquibase.command.GenerateChangeLogCommand.run(GenerateChangeLogCommand.java:45)\r\n    at liquibase.command.AbstractCommand.execute(AbstractCommand.java:8)\r\n    ... 4 more\r\nCaused by: liquibase.exception.DatabaseException: Expected single row from liquibase.statement.core.GetViewDefinitionStatement@1de5f259 but got 0\r\n    at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:146)\r\n    at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:157)\r\n    at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:152)\r\n    at liquibase.database.AbstractJdbcDatabase.getViewDefinition(AbstractJdbcDatabase.java:892)\r\n    at liquibase.snapshot.jvm.ViewSnapshotGenerator.snapshotObject(ViewSnapshotGenerator.java:78)\r\n    ... 22 more\r\nCaused by: liquibase.exception.DatabaseException: Empty result set, expected one row\r\n    at liquibase.util.JdbcUtils.requiredSingleResult(JdbcUtils.java:141)\r\n    at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:144)\r\n    ... 26 more\r\nFor more information, use the --logLevel flag"},"comment":{"url":"https://api.github.com/repos/liquibase/liquibase-postgresql/issues/comments/268363294","html_url":"https://github.com/liquibase/liquibase-postgresql/issues/3#issuecomment-268363294","issue_url":"https://api.github.com/repos/liquibase/liquibase-postgresql/issues/3","id":268363294,"user":{"login":"MarkWojciechowicz","id":11320108,"avatar_url":"https://avatars.githubusercontent.com/u/11320108?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkWojciechowicz","html_url":"https://github.com/MarkWojciechowicz","followers_url":"https://api.github.com/users/MarkWojciechowicz/followers","following_url":"https://api.github.com/users/MarkWojciechowicz/following{/other_user}","gists_url":"https://api.github.com/users/MarkWojciechowicz/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkWojciechowicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkWojciechowicz/subscriptions","organizations_url":"https://api.github.com/users/MarkWojciechowicz/orgs","repos_url":"https://api.github.com/users/MarkWojciechowicz/repos","events_url":"https://api.github.com/users/MarkWojciechowicz/events{/privacy}","received_events_url":"https://api.github.com/users/MarkWojciechowicz/received_events","type":"User","site_admin":false},"created_at":"2016-12-20T21:22:45Z","updated_at":"2016-12-20T21:22:45Z","body":"Sorry - this issue should have been posted to Jira - I will put it there"}}
{"actor":{"display_login":"MarkWojciechowicz"}}