Skip to main content
Solved

Error importing schema on DBMS ER

  • February 21, 2025
  • 3 replies
  • 32 views

Forum|alt.badge.img+1

When running the recommended import script on my Postgresql V17 database (Ubuntu 24)

 

Any help appreciated

Error is:

ERROR:  syntax error at or near "="LINE 1: SELECT COUNT(*) AS total FROM (SET enable_nestloop=0;SELECT …In statement:SELECT COUNT(*) AS total FROM (SET enable_nestloop=0;SELECT 'postgresql' AS dbms,t.table_catalog,t.table_schema,t.table_name,c.column_name,c.ordinal_position,c.data_type,c.character_maximum_length,n.constraint_type,k2.table_schema,k2.table_name,k2.column_name FROM information_schema.tables t NATURAL LEFT JOIN information_schema.columns c LEFT JOIN(information_schema.key_column_usage k NATURAL JOIN information_schema.table_constraints n NATURAL LEFT JOIN information_schema.referential_constraints r)ON c.table_catalog=k.table_catalog AND c.table_schema=k.table_schema AND c.table_name=k.table_name AND c.column_name=k.column_name LEFT JOIN information_schema.key_column_usage k2 ON k.position_in_unique_constraint=k2.ordinal_position AND r.unique_constraint_catalog=k2.constraint_catalog AND r.unique_constraint_schema=k2.constraint_schema AND r.unique_constraint_name=k2.constraint_name WHERE t.TABLE_TYPE='BASE TABLE' AND t.table_schema NOT IN('information_schema','pg_catalog')) AS sub

Best answer by Humas1985

@kerrya - Kindly separate the SET command from your query.

First, run the command "SET enable_nestloop = OFF;" as a standalone statement.

Then, execute your SELECT query in a separate step and give a try.

----------------------------------------------------------------------------------

In addition, you can also try using different syntax to set the parameter. Instead of the original command, use either "SET enable_nestloop TO OFF;" or "SET enable_nestloop = 'OFF';" as some PostgreSQL versions support "TO" instead of "=" for this purpose. If issues persist, try removing the semicolon and executing "SET enable_nestloop TO OFF".

Keep us posted on the outcome!! 

Regards

View original
Did this topic help you find an answer to your question?

Humas1985
Lucid Legend Level 9
Forum|alt.badge.img+21
  • Lucid Legend Level 9
  • February 22, 2025

Hi ​@kerrya 

Seems it is due to an incorrect use of SET enable_nestloop=0; within a SELECT statement

Try running SET enable_nestloop = OFF; separately before executing the query

Modify your script to separate the SET command from the SELECT statement, then give a try and keep us posted.

Best Regards

 


Forum|alt.badge.img+1
  • February 22, 2025
Humas1985 :

 

Seems it is due to an incorrect use of SET enable_nestloop=0; within a SELECT statement

Try running SET enable_nestloop = OFF; separately before executing the query

Modify your script to separate the SET command from the SELECT statement, then give a try and keep us posted.

 

 

I tried to run “SET enable_nestloop = OFF;” as a separate instruction on it’s own and got the following error:
 

ERROR:  syntax error at or near "="LINE 1: ...ELECT COUNT(*) AS total FROM (SET enable_nestloop = OFF) AS …I’m using the phpPgAdmin interface using teh SQL tab to run these instructions.Kerry

Humas1985
Lucid Legend Level 9
Forum|alt.badge.img+21
  • Lucid Legend Level 9
  • February 23, 2025

@kerrya - Kindly separate the SET command from your query.

First, run the command "SET enable_nestloop = OFF;" as a standalone statement.

Then, execute your SELECT query in a separate step and give a try.

----------------------------------------------------------------------------------

In addition, you can also try using different syntax to set the parameter. Instead of the original command, use either "SET enable_nestloop TO OFF;" or "SET enable_nestloop = 'OFF';" as some PostgreSQL versions support "TO" instead of "=" for this purpose. If issues persist, try removing the semicolon and executing "SET enable_nestloop TO OFF".

Keep us posted on the outcome!! 

Regards


Reply