pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alban Hertroys <haramrae@gmail.com>
To: Condor <condor@stz-bg.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Is there a way to replace select * fields in result ?
Date: Sat, 12 Jun 2021 11:15:37 +0200
Message-ID: <09C5EA9B-5BC3-441E-B4BC-484393085DB5@gmail.com> (raw)
In-Reply-To: <37a2bc0c7c8e90ea7620297e8d23515a@stz-bg.com>
References: <37a2bc0c7c8e90ea7620297e8d23515a@stz-bg.com>



> On 12 Jun 2021, at 10:00, Condor <condor@stz-bg.com> wrote:
> 
> select qw.*, case whem length(qw.mm) > 0 THEN COALESCE(SUBSTRING(qw.mm, 1, 1), '') ELSE qw.mm END AS qw.mm

A little off-topic, but isn’t that a roundabout way of writing just this?:

	select qw.*, coalesce(substring(qw.mm, 1, 1), '') as mm

Or even:

	select qw.*, coalesce(left(qw.mm, 1), '') as mm


Regards,

Alban Hertroys
--
There is always an exception to always.









view thread (4+ messages)

Message-ID: <09C5EA9B-5BC3-441E-B4BC-484393085DB5@gmail.com>
Permalink:  ../09C5EA9B-5BC3-441E-B4BC-484393085DB5@gmail.com/
Also on:    postgresql.org/message-id/09C5EA9B-5BC3-441E-B4BC-484393085DB5@gmail.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: haramrae@gmail.com, condor@stz-bg.com
  Subject: Re: Is there a way to replace select * fields in result ?
  In-Reply-To: <09C5EA9B-5BC3-441E-B4BC-484393085DB5@gmail.com>
  References: <37a2bc0c7c8e90ea7620297e8d23515a@stz-bg.com> <09C5EA9B-5BC3-441E-B4BC-484393085DB5@gmail.com>

* 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