G_Hosa_Phat - 2017-11-29

I just recently ran across SchemaSpy as I'm working on rebuilding my PostgreSQL database structure. After a couple of initial mishaps with basic configuration and figuring out how to format the CLI command, I've been able to produce a great diagram of my new database. However, I noted that all of the tables listed in my analysis report are showing a value of "-1" in the Rows column. Going back through the command line output, I noted a number of lines that say:

13:10:23.523 WARNING: Table.fetchNumRows - org.postgresql.util.PSQLException: ERROR: relation "<schemaname>.<TableName>" does not exist
  Position: 22

The <schemaname> listed is an all lower-case representation of the schema name I supplied in my command line arguments:

java -jar <PathToSSJAR>\schemaSpy.jar -dp <PathToJDBCDriver>\postgresql-42.1.4.jar -t pgsql -host <HOSTNAME> -db <databasename> -s "<SchemaName>" -u <username> -p <password> -o <PathToOutputFile>

My schemas and tables are created using mixed-case names (because I'm weird like that), but it appears that SchemaSpy is not using it as mixed-case in the fetchNumRows function. I've tried it both with and without double-quotes around the original schema name, but both give me the same result. I even tried it with single-quotes around the schema name, but that gave me the following error:

No tables or views were found in schema ''<SchemaName>''.
The schema does not exist in the database.
Make sure that you specify a valid schema with the -s option and that
  the user specified (<username>) can read from the schema.
Note that schema names are usually case sensitive.

As an example, if I have a schema called "Company", I set the -s parameter in my command line to read:

-s "Company"

But, in the warning, it shows it as lower-case:

13:45:45.561 WARNING: Table.fetchNumRows - Unable to extract the number of rows for table <TableName>, using '-1'
13:45:45.561 WARNING: Table.fetchNumRows - org.postgresql.util.PSQLException: ERROR: relation "company.<TableName>" does not exist
  Position: 22
13:45:45.561 WARNING: Table.fetchNumRows - org.postgresql.util.PSQLException: ERROR: relation "company.<TableName>" does not exist
  Position: 22

One thing to note is that it DOES have the correct mixed-case name of the table name. It's only the schema name that's converted to all lower-case.

 

Last edit: G_Hosa_Phat 2017-11-29