[GENERAL] Spurious rows returned with left join?

2006-04-04 Thread Edmund Bacon
I think I have stumbled on a bug, though I'm not entirely sure about that. Things do seem to get a little fuzzy when using outer joins Consider the following: create table t1(t1_a int); insert into t1 values (1); insert into t1 values (2); insert into t1 values (3); create table

Re: [GENERAL] Spurious rows returned with left join?

2006-04-04 Thread Edmund Bacon
Tom Lane wrote: Edmund Bacon [EMAIL PROTECTED] writes: Consider the following: ... Note that I get 2 rows where t1_a = 3. Are you getting a Merge Right Join plan for that? If so, you're likely getting bit by this bug: 2006-03-17 14:38 tgl That's correct. After doing

Re: [GENERAL] hpw to Count without group by

2005-06-02 Thread Edmund Bacon
[EMAIL PROTECTED] (Yudie Pg) writes: Hello, I have a table, structure like this: create table product( sku, int4 not null, category int4 null, display_name varchar(100) null, rank int4 null ) let say example data: sku, category, display_name === 10001, 5,

Re: [GENERAL] Count and Results together

2005-05-20 Thread Edmund Bacon
[EMAIL PROTECTED] (Jan Sunavec) writes: I am using libpg.so. I assume that you mean libpq ? I tryed find solution for this problem in internet but, I don't find nothing yet. I have idea get rowcount throught some function write in C. Or is there any plan add this feature into PostgreSQL?

Re: [GENERAL] CSV delim quoting differences PgCOPY, Excel etc...

2005-05-18 Thread Edmund Bacon
[EMAIL PROTECTED] (Jerry Sievers) writes: Hello. Anyway, I am often enough having to load Pg databases using SQL COPY from CSV output written by Excel, that I've had to write a script to change the quoting behavior from Excel's putting double quotes around a field having embedded delim

Re: [GENERAL] Debugging deadlocks

2005-04-02 Thread Edmund Bacon
[EMAIL PROTECTED] (Bruno Wolff III) writes: Using domains is a good way to keep column constraints in just one place. Speaking of domains, how do you find out what the range of a domain is? eg: test=# create domain fruit as text check( value in ('apple', 'orange', 'banana', 'pear')); CREATE

Re: [GENERAL] fied separator change from the shell command line

2005-03-13 Thread Edmund Bacon
[EMAIL PROTECTED] writes: Hello, I'm trying to change the usal | table field separator from the shell command line: psql -d ect -f pl_lost.sql -o pl_lost.out.txt -F \t -U asaadmin But it doesn't work. It keeps the same | separator in the output file. Can anyone please help me? I need

Re: [GENERAL] Stuck with a query...

2005-03-13 Thread Edmund Bacon
[EMAIL PROTECTED] (Greg Stark) writes: Geoff Caplan [EMAIL PROTECTED] writes: Hi folks, Sorry to ask a newbie SQL question but I'm struggling... There's no efficient way to write this in standard SQL. However Postgres has an extension DISTINCT ON that would do it: select

Re: [GENERAL] Novice Question

2005-03-01 Thread Edmund Bacon
[EMAIL PROTECTED] (Michael Romagnoli) writes: What kind of command would I run if I wanted to copy an entire table (along with renaming it, and, of course, all data from the first table - some of which is binary)? SELECT * INTO newtable FROM oldtable; Note that this doesn't construct

Re: [GENERAL] basic trigger using OLD not working?

2005-02-28 Thread Edmund Bacon
[EMAIL PROTECTED] (Rick Casey) writes: CREATE OR REPLACE FUNCTION logPedigreesDel() RETURNS TRIGGER AS ' begin RAISE EXCEPTION ''OLD.famindid = '', OLD.famindid; RAISE EXCEPTION ''OLD.famindid = %'', OLD.famindid; ^ return OLD; end; '

Re: [GENERAL] disabling constraints

2004-11-07 Thread Edmund Bacon
[EMAIL PROTECTED] (Vivek Khera) writes: DP == David Parker [EMAIL PROTECTED] writes: DP I would like to be able to truncate all of the tables in a schema DP without worrying about FK constraints. I tried issuing a SET DP CONSTRAINTS ALL DEFERRED before truncating, but I still get DP

Re: [GENERAL] Issue adding foreign key

2004-10-31 Thread Edmund Bacon
[EMAIL PROTECTED] (George Woodring) writes: I have 2 existing tables in my db: iss= \d pollgrpinfo Table public.pollgrpinfo Column | Type | Modifiers ---++--- pollgrpinfoid | integer| not

Re: [GENERAL] adding missing FROM-clause

2004-10-31 Thread Edmund Bacon
[EMAIL PROTECTED] (C G) writes: Dear All, I have a simple join query SELECT c1 FROM t1 INNER JOIN t2 ON t2.c2 = t1.c2 WHERE t3.c3= t2.c3; Which gives the expected result but I get the message NOTICE: adding missing FROM-clause entry for table t3 How do I get rid of this NOTICE,

Re: [GENERAL] ON DELETE trigger blocks delete from my table

2004-10-30 Thread Edmund Bacon
[EMAIL PROTECTED] (Naeem Bari) writes: I understand. Makes sense. Is there anyway for my trigger function to know that it is being called on a delete or on an update? Because I do need to return new on update... and I really don't want to write 2 different functions, one for update and one

Re: [GENERAL] earthdistance is not giving correct results.

2004-10-03 Thread Edmund Bacon
[EMAIL PROTECTED] (mike cox) writes: I'm running PostgreSQL 8.0 beta 1. I'm using the earthdistance to find the distance between two different latitude and logitude locations. Unfortunately, the result seems to be wrong. Here is what I'm doing: select

Re: [GENERAL] SELECT based on function result

2004-07-18 Thread Edmund Bacon
Robert Fitzpatrick wrote: I have a function that tells me if a record is positive and negative based on several field values. I use it in select statements: ohc= SELECT sample_id, is_wipe_positive(tblleadwipe.sample_id) AS positive FROM tblleadwipe WHERE hud_building_id IS NOT NULL;