Avatar of gregfthompson
gregfthompson
Flag for Australia asked on

postgresql problem - script to create tables does not run

In postgresql 9.6 (running under Windows 7 64),  I attempted to run a script to create tables but it showed this error:

ERROR:  table "street_locality_point" does not exist
********** Error **********

ERROR: table "street_locality_point" does not exist
SQL state: 42P01

The problem is that "street_locality_point" does exist in lines 14, and 333 and 334.

What is causing this error?
create_tables_ansi.sql
PostgreSQL

Avatar of undefined
Last Comment
Dave Baldwin

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Pawan Kumar

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Dave Baldwin

The DROP TABLE on line 14 will cause an error if the table does not exist.  Try...

DROP TABLE IF EXISTS STREET_LOCALITY_POINT;

http://www.postgresqltutorial.com/postgresql-drop-table/
gregfthompson

ASKER
Thanks Pawan and Dave,

I ran Pawan's solution and received this result:

"Query returned successfully with no result in 512 msec."

I am unable to see what is wrong with this script?

Greg
SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
gregfthompson

ASKER
No tables created.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
gregfthompson

ASKER
Thanks heaps.
gregfthompson

ASKER
Oops. It appears one of my messages was not posted. The tables were created after I clicked on the tables name.  Thanks so much for your help.
Dave Baldwin

Glad you got it working.  In my copy of PostGreSQL, I had to replace 'REM' with '--' to get the DROP TABLE statements to work.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.