Home » U++ Library support » U++ SQL » ExportSch, zero byte file is the result
Re: ExportSch, zero byte file is the result [message #21961 is a reply to message #21932] |
Fri, 12 June 2009 14:30   |
jeremy_c
Messages: 175 Registered: August 2007 Location: Ohio, USA
|
Experienced Member |
|
|
Ok, I found the problem, it's specific to PostgreSQL. The query that gets run to enum the tables is:
select n.nspname || '.' || c.relname
from pg_catalog.pg_class c
left join pg_catalog.pg_namespace n on n.oid = c.relnamespace
where c.relkind = 'r' and
n.nspname like 'mydb' and
pg_catalog.pg_table_is_visible(c.oid)
When I call:
ExportSch(session, "mydb");
There is no namespace named "mydb". It's named "public". Here's an example output:
mydb=> SELECT n.nspname,n.oid FROM pg_catalog.pg_namespace n;
nspname | oid
--------------------+----------
pg_catalog | 11
pg_toast | 99
pg_temp_1 | 11052
pg_toast_temp_1 | 11053
information_schema | 11313
public | 2200
pg_temp_34 | 23600075
pg_toast_temp_34 | 23600076
(8 rows)
Only the tables that are in the current database are accessible. So, anything public is really what's in the connected database. If I change my code to read:
ExportSch(session, "public");
even though I am connected to "mydb", then the schema is dumped.
I ran your code that you posted above (with a PostgreSQLSession instead) and it writes a 0 byte file. Doing what is above in this message causes everything to work.
Jeremy
|
|
|
Goto Forum:
Current Time: Sun Jun 29 14:39:59 CEST 2025
Total time taken to generate the page: 0.03624 seconds
|