Any fixes or suggestions for further
investigation of this situation would be
appreciated.

I'm using some code to generate an insert
statement from a hash of ( field => value ).
The fields are taken from keys %argz, the
placeholders from ( '?' ) x @fieldz.

Turning on tracing of the SQL gives me:


BioDB::Database::execute_insert_returning(/sandbox/lembark/Bio-DB/inwork/lib/BioDB/Database.pm:205):
    205:        $sth->trace( 'SQL' );


                       DB<1>

BioDB::Database::execute_insert_returning(/sandbox/lembark/Bio-DB/inwork/lib/BioDB/Database.pm:207):
    207:        $sth->execute( @_ );


                       DB<1>
    PREPARE dbdpg_p22364_7 AS
                insert into type
                ( publish,name,dataset_id,ontology_id )
                values
                ( $1,$2,$3,$4 )
                returning
                type_id
            ;

    EXECUTE dbdpg_p22364_7 (
    $1: 2009-03-11 13:20:20
    $2: GenBank_hidden_flag
    $3: 2
    $4: 3
    );

So far, so good: this *is* the SQL and those are
the correct arguments.

Catch: execute fails with:

    DBD::Pg::st execute failed: ERROR:  Perl hash contains
    nonexistent column "fact_type_id" at
    /sandbox/lembark/Bio-DB/inwork/lib/BioDB/Database.pm line
    207.  at
    /sandbox/lembark/Bio-DB/inwork/lib/BioDB/Database.pm line 207

Indeed, "fact_type_id" is not in the type table, but
is also is not in the SQL!

Using "prepare" instead of "prepare_cached" gave the
same result.

Identically-generated copies of this SQL run just fine
in other places of the code.

Aside: dbd-pg is not on the perl.org mailing list database.
Where is the subscription page?

thanx


-- 
Steven Lembark                                            85-09 90th St.
Workhorse Computing                                 Woodhaven, NY, 11421
[email protected]                                      +1 888 359 3508

Reply via email to