Re: [SQL] Different query results in psql and Perl DBI with Postgres 7.2.1

2004-01-11 Thread Greg Sabino Mullane

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
 
 
Brendan LeFebvre writes:
 
> Even more perplexing: the "0E0" occurs ONLY when setting status to
> 'STORE', and not 100% of the time. (though it happens far more often
> than not.) It seems to operate in stretches, too: when I am getting
> 1-row updates back from the latter query type, it happens several
> times in succession.
 
"0E0" is perl's way of saying "0 but true", which means that the
statement succeeded, but did not return any rows. If it simply
returned a "0", we would not be able to differentiate between
an error (false) and no rows affected (0).
 
> Where do I even begin to attempt a diagnosis?
 
It looks as thogh the row you are trying to update does not
exist. Not much more advice is possible without seeing a more
complete sample of the code.
 
"boyd" writes:
 
> $info =~ s/0//g; # the get_info adds extraneous '0' to the version number
 
It is not extraneous: it is required per the ODBC spec. For a simpler
number, try using this:
 
my $pgversion = $dbh->{private_dbdpg}{server_version};
 
 
- --
Greg Sabino Mullane [EMAIL PROTECTED]
PGP Key: 0x14964AC8 20040401
 
-BEGIN PGP SIGNATURE-
 
iD8DBQFAAaEwvJuQZxSWSsgRAk59AJ4zeNNm225TdecB2wgcQnFIJNqpmgCePmdX
XAPC7vVv+517CR2g3p/6U6c=
=oSYK
-END PGP SIGNATURE-



---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


[SQL] Left outer join on multiple tables

2004-01-11 Thread David Witham
Hi all,

Is there a way to do left outer joins on more than 2 tables at once (3 in my case)? Or 
do I have to do the first join into a temp table and then another join from the temp 
table to the third table? I can't seem to work out the syntax from the User Guide.

Thanks,

David Witham
Telephony Platforms Architect
Unidial
Ph: 03 8628 3383
Fax: 03 8628 3399


---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [SQL] Left outer join on multiple tables

2004-01-11 Thread Peter Eisentraut
David Witham wrote:
> Is there a way to do left outer joins on more than 2 tables at once
> (3 in my case)? Or do I have to do the first join into a temp table
> and then another join from the temp table to the third table? I can't
> seem to work out the syntax from the User Guide.

SELECT * FROM a LEFT JOIN b ON (...) LEFT JOIN c ON c WHERE ...


---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


[SQL] Select into

2004-01-11 Thread beyaRecords - The home Urban music
Hi,
I want to copy a sequence of rows from one table into another table. I 
have tried select into but this will only work if the table you are 
copying to does not already exist. How do I copy to a table that does 
already exist?

regards

Uzo

---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org


Re: [SQL] Missing data for column

2004-01-11 Thread azwa


Hi, 

  Sorry for the late respond. i've solved my problem. the error comes out when the data has subsidiary column but 
there is no subsidiary column in table. tq 







Michael Glaesemann <[EMAIL PROTECTED]>

01/09/2004 06:54 PM ZE9


        To:        [EMAIL PROTECTED]
        cc:        [EMAIL PROTECTED]
        Subject:        Re: [SQL] Missing data for column



On Jan 9, 2004, at 4:15 PM, [EMAIL PROTECTED] wrote:

> Hi,
>
> i got an error below after running copy command . the table structure 
> as
> following :
>
>           Table "biosadm.custinv_temp
>    Column    |     Type      |
> -+---+-
>  yr          | integer       |
>  custname    | text          |
>  invstatus   | text          |
>  custlo      | text          |
>  invno       | integer       |
>  invdate     | date          |
>  amount      | numeric(10,2) |
>  acc         | text          |
>  salesperson | text          |
>
> ERROR:  copy: line 1, Missing data for column "subsidiary"

Could you include the COPY command you're using, as well as the first 
couple of lines of the file you're copying from? It's hard to know what 
the problem is without this.

Regards,

Michael Glaesemann
grzm myrealbox com



[SQL] Problem with NOT IN portion of query.

2004-01-11 Thread Robert Creager

Hey All,

Probably doing something stupid, and I'm too tired to see what.  The query I'm
trying to execute is:

SELECT date_trunc( 'hour', "when" )::timestamp AS
period FROM readings WHERE period NOT IN (SELECT "time" FROM
hour.summary_period) GROUP BY period ORDER BY period;

Where the table definitions are:

CREATE TABLE readings ( "when" TIMESTAMP DEFAULT now() NOT NULL PRIMARY KEY );
CREATE SCHEMA hour;
CREATE TABLE hour.summary_period ( "time" TIMESTAMP NOT NULL );

The error is:

ERROR:  column "period" does not exist

When I remove the NOT IN (and associated WHERE), the query works fine.

Any help?

Cheers,
Rob

-- 
 20:55:35 up 14 days, 10:45,  4 users,  load average: 2.01, 2.04, 2.05


pgp0.pgp
Description: PGP signature


[SQL] Unique key field or serverl fks ?

2004-01-11 Thread katarn
Hi,

I would like to know opinions about which approach is better:

Having a table with a field that works as a unique key, or having 
several fks that work as a combined key ( all the fks fields )?

Thanks in advance,

K.

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [SQL] Problem with NOT IN portion of query.

2004-01-11 Thread Tomasz Myrta
Dnia 2004-01-12 05:04, Użytkownik Robert Creager napisał:
Hey All,

Probably doing something stupid, and I'm too tired to see what.  The query I'm
trying to execute is:
SELECT date_trunc( 'hour', "when" )::timestamp AS
period FROM readings WHERE period NOT IN (SELECT "time" FROM
hour.summary_period) GROUP BY period ORDER BY period;
Where the table definitions are:

CREATE TABLE readings ( "when" TIMESTAMP DEFAULT now() NOT NULL PRIMARY KEY );
CREATE SCHEMA hour;
CREATE TABLE hour.summary_period ( "time" TIMESTAMP NOT NULL );
The error is:

ERROR:  column "period" does not exist

When I remove the NOT IN (and associated WHERE), the query works fine.
Your problem has nothing to "NOT IN".
Your query works fine, when you remove column alias from WHERE clause - 
it's beacause WHERE clause is executed *before* data output (and before 
column aliases). You can still use column aliases in "GROUP BY" and 
"ORDER BY".

Regards,
Tomasz Myrta
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster