Re: SELECT UNION into a text[]

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: SELECT UNION into a text[]
Date: 2018-10-10 08:29:14
Message-ID: 87sh1e8aw4.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>>> "David" == David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> writes:

>> SELECT ARRAY_AGG(hashed)
>> FROM words_nouns
>> WHERE added > TO_TIMESTAMP(1539100913)
>> UNION
>> SELECT ARRAY_AGG(hashed)
>> FROM words_verbs
>> WHERE added > TO_TIMESTAMP(1539100913);

David> SELECT array_agg(words) FROM (
David> SELECT hashed FROM words_nouns
David> UNION ALL
David> SELECT hashed FROM words_verbs
David> ) AS src

Or even better,

SELECT ARRAY(SELECT hashed FROM words_nouns
UNION
SELECT hashed FROM words_verbs);

--
Andrew (irc:RhodiumToad)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Aleš Zelený 2018-10-10 08:31:48 Re: tds_fdw binary column
Previous Message magodo 2018-10-10 07:52:18 Re: how to identify the timeline of specified recovery_target_time when do multiple PITR