db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tomislav Nakic-Alfirevic (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DDLUTILS-151) Can not export data if multiple schemas from PostgreSQL
Date Fri, 13 Mar 2009 18:01:56 GMT

    [ https://issues.apache.org/jira/browse/DDLUTILS-151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681844#action_12681844
] 

Tomislav Nakic-Alfirevic commented on DDLUTILS-151:
---------------------------------------------------

I can confirm the issue: it's exactly the way Laurent described it.
In my case, I have several postgresql (8.3) databases available and the ones where I only
have tables in the "default" schema I can export from nicely (well, aside from issue 212 which
would be fixed for me by commenting out one line of code, Database.java:451), but the ones
where I have tables in multiple schemas break the export.
Here are a couple of details...

$ ant -v export-source-db
Apache Ant version 1.7.0 compiled on August 29 2007
Buildfile: build.xml
Detected Java version: 1.6 in: /usr/lib/jvm/java-6-sun-1.6.0.07/jre
Detected OS: Linux
parsing buildfile /home/tna/projekti/PanBI/acta/ddlutils/build.xml with URI = file:/home/tna/projekti/PanBI/acta/ddlutils/build.xml
Project base dir set to: /home/tna/projekti/PanBI/acta/ddlutils
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml.
It could not be found.
Build sequence for target(s) `export-source-db' is [export-source-db]
Complete build sequence is [export-source-db, ]

export-source-db:
[databaseToDdl] Written schema to /home/tna/projekti/PanBI/acta/ddlutils/db-schema.xml

BUILD FAILED
/home/tna/projekti/PanBI/acta/ddlutils/build.xml:12: Error while performing a query
	at org.apache.ddlutils.task.Command.handleException(Command.java:81)
	at org.apache.ddlutils.task.WriteDataToFileCommand.execute(WriteDataToFileCommand.java:101)
	at org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(DatabaseTaskBase.java:341)
	at org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:381)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.Main.runBuild(Main.java:698)
	at org.apache.tools.ant.Main.startAnt(Main.java:199)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: org.apache.ddlutils.DatabaseOperationException: Error while performing a query
	at org.apache.ddlutils.platform.PlatformImplBase.query(PlatformImplBase.java:1565)
	at org.apache.ddlutils.io.DatabaseDataIO.writeDataForTableToXML(DatabaseDataIO.java:538)
	at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:381)
	at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:320)
	at org.apache.ddlutils.task.WriteDataToFileCommand.execute(WriteDataToFileCommand.java:95)
	... 19 more
Caused by: org.postgresql.util.PSQLException: ERROR: relation "cinj_spis_1_stupanj_snimka"
does not exist
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:236)
	at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
	at org.apache.ddlutils.platform.PlatformImplBase.query(PlatformImplBase.java:1559)
	... 23 more
--- Nested Exception ---
org.apache.ddlutils.DatabaseOperationException: Error while performing a query
	at org.apache.ddlutils.platform.PlatformImplBase.query(PlatformImplBase.java:1565)
	at org.apache.ddlutils.io.DatabaseDataIO.writeDataForTableToXML(DatabaseDataIO.java:538)
	at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:381)
	at org.apache.ddlutils.io.DatabaseDataIO.writeDataToXML(DatabaseDataIO.java:320)
	at org.apache.ddlutils.task.WriteDataToFileCommand.execute(WriteDataToFileCommand.java:95)
	at org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(DatabaseTaskBase.java:341)
	at org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:381)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
	at org.apache.tools.ant.Main.runBuild(Main.java:698)
	at org.apache.tools.ant.Main.startAnt(Main.java:199)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "cinj_spis_1_stupanj_snimka"
does not exist
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:236)
	at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
	at org.apache.ddlutils.platform.PlatformImplBase.query(PlatformImplBase.java:1559)
	... 23 more

Total time: 10 seconds
$

My build.xml is as follows:

<?xml version="1.0"?>
<project name="MigrateToDerby" basedir=".">
	<path id="classpath">
		<fileset dir="./lib">
			<include name="**/*.jar"/>
		</fileset>
	</path>
	<target name="export-source-db" description="Dumps db structure and data">
		<taskdef name="databaseToDdl" classname="org.apache.ddlutils.task.DatabaseToDdlTask">
		<classpath refid="classpath"/>
	</taskdef>
	<databaseToDdl modelName="MigrateTest">
		<database url="jdbc:postgresql://localhost/acta" driverClassName="org.postgresql.Driver"
username="snip!" password="snip!"/>
		<writeSchemaToFile outputFile="db-schema.xml"/>
		<writeDataToFile outputFile="data.xml"/>
	</databaseToDdl>
	</target>
</project> 


Now, I've tried modifying ddlutils code to output things which would help me understand what's
going on, but I don't know how I have to set up logging so that I get any kind of output from
statements like _log.debug(sql) and the like. Can you give me a hint? Is there any documentation
for ddlutils developers (tools to use, environment setup etc.)?

Anyway, to conclude, I think the reason it's breaking is the following:
1.) JdbcModelReader.determineSchemaOf(Connection, String, Table) fails to determine the table
schema
2.) PostgreSqlModelReader.java doesn't override deterimenSchemaOf and so that's it

It should be easy enough to verify: check the value of the local variable "schema" after the
DatabaseDataIO:482 statement (I obtained ddlutils by compiling it from a fresh svn trunk checkout
a couple hours ago).

> Can not export data if multiple schemas from PostgreSQL
> -------------------------------------------------------
>
>                 Key: DDLUTILS-151
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-151
>             Project: DdlUtils
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: PostgreSQL 8.1.4 on i486-pc-linux-gnu, compiled by GCC gcc-4.0.gcc-opt
(GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
> Ant tasks
>            Reporter: Laurent ROCHE
>            Assignee: Thomas Dudziak
>             Fix For: 1.2
>
>
> When running an Ant Task, databaseToDdl with writeDataToFile on a PosgreSQL database
with more than the public database, DDL-Utils fails !
> The error message is:
>  org.apache.ddlutils.DatabaseOperationException: Error while performing a query
> and adding the option verbosity="DEBUG" does not add more information.
> Cheers,
> L@u

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message