Thread: script errors or PEBKAC?

script errors or PEBKAC?

From
Thufir Hawat
Date:
I cannot get the script here:

https://docs.google.com/leaf?id=0B5hKxkS1VyAxOGMzZjY4ZjktZjZkOS00Zjc3LWExYmEtYTU3ZThjYzZiMjk3&hl=en

to run correctly.  Looking at the output, many, many, errors, it seems
to assume tables exist which don't. Is that correct?

The script is supposed to create a database, but it seems to assume that
the schema is already there and configured?

Or, maybe I'm not running it correctly?


thanks,

Thufir


Re: script errors or PEBKAC?

From
Michael Black
Date:
I would check the order in which things are being created in your process.

What I usually do is create all the tables sans indexing or constraints (except primary key).  Once the table are done, load the data in to the tables that need to be populated.  Then constraints, triggers and then indexes.  But, hey, that is just me.  One thing, make sure you know your data.  I mean if you are adding new (not before used on the data) unique indexes, make sure the loaded data will support that uniqueness.

Just 2 cents.
Michael

> From: hawat.thufir@gmail.com
> To: pgsql-general@postgresql.org
> Date: Fri, 4 Mar 2011 07:48:04 -0800
>
> I cannot get the script here:
>
> https://docs.google.com/leaf?id=0B5hKxkS1VyAxOGMzZjY4ZjktZjZkOS00Zjc3LWExYmEtYTU3ZThjYzZiMjk3&hl=en
>
> to run correctly. Looking at the output, many, many, errors, it seems
> to assume tables exist which don't. Is that correct?
>
> The script is supposed to create a database, but it seems to assume that
> the schema is already there and configured?
>
> Or, maybe I'm not running it correctly?
>
>
> thanks,
>
> Thufir
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

Re: script errors or PEBKAC?

From
Adrian Klaver
Date:
On 03/04/2011 07:48 AM, Thufir Hawat wrote:
> I cannot get the script here:
>
> https://docs.google.com/leaf?id=0B5hKxkS1VyAxOGMzZjY4ZjktZjZkOS00Zjc3LWExYmEtYTU3ZThjYzZiMjk3&hl=en
>
> to run correctly.  Looking at the output, many, many, errors, it seems
> to assume tables exist which don't. Is that correct?

Actually no. The tables do exist but they have dependencies:

ERROR:  cannot drop table izposoja because other objects depend on it
DETAIL:  constraint fk_knjiga_i_relations_izposoja on table
knjiga_izposoja depends on table izposoja
HINT:  Use DROP ... CASCADE to drop the dependent objects too.

The script is trying to DROP the table but cannot as CASCADE was not
included in the DROP statement. This is repeated for other tables also.
This accounts for some of the errors. The rest seem to follow from this.
The tables are not dropped but then data is put into them that conflicts
the pre-existing data.

>
> The script is supposed to create a database, but it seems to assume that
> the schema is already there and configured?

If it is supposed to create a database it is doing it on one that exists
already, which this script is unable to handle. Without seeing the
actual script it hard to say exactly why.

>
> Or, maybe I'm not running it correctly?

Yes:)

>
>
> thanks,
>
> Thufir
>
>


--
Adrian Klaver
adrian.klaver@gmail.com

Re: script errors or PEBKAC?

From
Adrian Klaver
Date:
On 03/04/2011 07:48 AM, Thufir Hawat wrote:
> I cannot get the script here:
>
> https://docs.google.com/leaf?id=0B5hKxkS1VyAxOGMzZjY4ZjktZjZkOS00Zjc3LWExYmEtYTU3ZThjYzZiMjk3&hl=en
>
> to run correctly.  Looking at the output, many, many, errors, it seems
> to assume tables exist which don't. Is that correct?
>
> The script is supposed to create a database, but it seems to assume that
> the schema is already there and configured?
>
> Or, maybe I'm not running it correctly?
>
>
> thanks,
>
> Thufir
>
>

Did not realize actual script was at bottom of text file. I see nothing
in the script that creates a database, so the script assumes you have
created an empty database to run against. You seem to be running it a
populated database.

--
Adrian Klaver
adrian.klaver@gmail.com