pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feed From: chris <yuanzefuwater@126.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: aditya desai <admad123@gmail.com>
Cc: pgsql-sql <pgsql-sql@lists.postgresql.org>
Cc: stercor@gmail.com <stercor@gmail.com>
Subject: Re: Constructing colum name as alias
Date: Thu, 11 Nov 2021 22:23:57 +0800 (GMT+08:00)
Message-ID: <18007723.72e9.17d0f62427a.Coremail.yuanzefuwater@126.com> (raw )
In-Reply-To: <CAKFQuwb9FkB1HcwU0KNnxqGFe-GEoH3BEq+gv=x4J4=+V854vw@mail.gmail.com >
References: <CAN0SRDH0DhD=WUCbyZ6mG9XGbEyuTaTvaMqoBZc_++7uNxpvrg@mail.gmail.com >
<CAKFQuwbbBanTecKXa=ejrYmSoPADT6OdJwnkzOqn-onAhyff-A@mail.gmail.com >
<CAPDmd-DOAMRhiQskxOh9UZGOcNXCvUdY2tTdcvggOTXyXaebEQ@mail.gmail.com >
<CAKFQuwYWMmDo+KNxw1Ov3hj7iMg9OSFOBrunXh=45cZvmSMOGQ@mail.gmail.com >
<CAKFQuwb9FkB1HcwU0KNnxqGFe-GEoH3BEq+gv=x4J4=+V854vw@mail.gmail.com >
A flexible way to application, don’t know the actually value🤦♂️ see below:
select * from (Select ('Status as on '||date_part('day', (SELECT current_timestamp))||'th '||TO_CHAR(current_timestamp, 'Mon'))
union all
select now()::text from t1) foo limit 11;
Regards,
Chris
On 11/11/2021 22:16,David G. Johnston<david.g.johnston@gmail.com> wrote:
On Thu, Nov 11, 2021 at 7:14 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Thu, Nov 11, 2021 at 6:23 AM Theodore M Rolle, Jr. <stercor@gmail.com> wrote:
May we have an example?
Here are the docs detailing writing dynamic SQL commands in pl/pgsql.
https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
Though, as you probably want to see these columns in your application you will probably need to translate the concept to whatever programming language and database client interface you are using.
David J.
Attachments:
[image/png] 570999AB-25A0-4066-8155-6FEB5AE562F2.png (201.9K, ../18007723.72e9.17d0f62427a.Coremail.yuanzefuwater@126.com/3-570999AB-25A0-4066-8155-6FEB5AE562F2.png)
download | view image
view thread (7+ messages)
Message-ID: <18007723.72e9.17d0f62427a.Coremail.yuanzefuwater@126.com>
Permalink: ../18007723.72e9.17d0f62427a.Coremail.yuanzefuwater@126.com/
Also on: postgresql.org/message-id/18007723.72e9.17d0f62427a.Coremail.yuanzefuwater@126.com
copy link · copy postgr.es
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: yuanzefuwater@126.com, david.g.johnston@gmail.com, admad123@gmail.com, pgsql-sql@lists.postgresql.org, stercor@gmail.com
Subject: Re: Constructing colum name as alias
In-Reply-To: <18007723.72e9.17d0f62427a.Coremail.yuanzefuwater@126.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