Skip site navigation (1) Skip section navigation (2)

Re: sequencing two tables

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Shachar Shemesh <psqll(at)shemesh(dot)biz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: sequencing two tables
Date: 2004-11-29 02:48:54
Message-ID: 20041128184032.D12412@megazone.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-general
On Sun, 28 Nov 2004, Shachar Shemesh wrote:

> I need to create a list of all rows of the combination of two tables.
> For reasons I can't go into, I need this list to be in a single query,
> and not write a function to do it.
>
> I thought about doing something like this:
> select |COALESCE(table1.field, table2.field) as field from table1 full
> outer join table2 on false
>
> There is just one small problem. Even though logically this does what
> I'm trying to do, postgres says:
> "FULL JOIN is only supported with merge-joinable conditions".
>
> I don't even understand the error message, much less whether I'm doing
> anything wrong, and whether I'm missing something stupifyingly obvious here.

We don't support join conditions like the above at this point.  The
message isn't terribly helpful though.

Fortunately, I think some variant like
 select table1.field from table1
  union all
 select table2.field from table2;
will give you the output you're looking for.

In response to

Responses

pgsql-general by date

Next:From: Jim SeymourDate: 2004-11-29 03:13:06
Subject: Re: [HACKERS] Adding Reply-To: <listname> to Lists configuration ...
Previous:From: Adam ErnstDate: 2004-11-29 02:48:21
Subject: Table and Field Schemas

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group