Hi,
There are 861 tables in the ofbiz Derby database under ofbiz-16.11.02 for demo
data. I'm trying to learn to load this data manually using SQL queries, and
thus making a dependency list of tables with foreign key requirements (or even
references to other tables which are allowed to be null). Basically, no table
referencing another table's data can be loaded without first loading that
parent table. With 861 tables and some tables having more than one foreign key
I wanted to automate this with a SQL query (I'm using SQuirrel-sqL to explore
now). As such I'm looking at system tables describing constraints and keys.
Through system tables I can find a list of tables and the ID of constraints
which are foreign keys. However, I seem to be losing the battle to find the
name of the foreign table and foreign column name to which the constraint
points (only the table with the originating constraint is easy to find and
automate a listing for). I see this may be possible to find through JDBC;
SQuirrel-sqL itself shows imported and exported keys with no apparent means to
export the information. Can anyone tell me if it is possible to use an ordinary
SQL query to find all foreign keys of a table and print the list of the child
table and the parent foreign table.column? If I can do this I can get around
the missing WebPOS setup functionality and edit/load SQL directly (I'm using
PostegreSQL so I can't edit a Derby database directly...it needs to be copied
over to PostgresSQL first in the proper order).
If you think I need to write a JDBC app instead to map table load order
dependencies, please let me know. I don't believe there is any other way to use
the WebPOS without doing it this way. I hate to think I may have to go through
all of those tables and hand write a spreadsheet with the dependencies.
Thanks!