pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Philippe Lang <philippe.lang@attiksystem.ch>
To: pgsql-sql@postgresql.org
Subject: Re: function expression in FROM may not refer to other relations of same query level
Date: Wed, 11 Aug 2004 08:41:07 +0200
Message-ID: <6C0CF58A187DA5479245E0830AF84F420803B3@poweredge.attiksystem.ch> (raw)

Hello,

> Whats wrong with just using CASE:
> 
> select id, usr, code,
>     case when code = 1 then 'A' else 'Z' end as line1,
>     case when code = 1 then 'A' else 'Z' end as line2 from tbl; 

The code I showed in my last mail was actually test code only. The logic
is more complicated, and I'm not sure it's possible to implement it with
a SELECT... CASE. What's more, the "get_lines" function already exists,
and is already used in different parts of the database. I would like, if
possible, to use it without changing it, or duplicating code.

Philippe



view thread (9+ messages)  latest in thread

Message-ID: <6C0CF58A187DA5479245E0830AF84F420803B3@poweredge.attiksystem.ch>
Permalink:  ../6C0CF58A187DA5479245E0830AF84F420803B3@poweredge.attiksystem.ch/
Also on:    postgresql.org/message-id/6C0CF58A187DA5479245E0830AF84F420803B3@poweredge.attiksystem.ch

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: philippe.lang@attiksystem.ch
  Subject: Re: function expression in FROM may not refer to other relations of same query level
  In-Reply-To: <6C0CF58A187DA5479245E0830AF84F420803B3@poweredge.attiksystem.ch>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox