Search Postgresql Archives

Re: Convert pg_constraint.conkey array to same-order array of column names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 24, 2023 at 11:51 AM Alvaro Herrera <alvherre@xxxxxxxxxxxxxx> wrote:
On 2023-Mar-23, Dominique Devienne wrote:
> But I'm wondering about getting 1 row per constraint instead,
> and fetching an array of column names.

IIRC you can use array_agg(unnest ORDER BY ordinality), grouping by
constraint OID or name.
 
Thanks. This lead me to a better search, yielding two informative results:
https://stackoverflow.com/questions/60877627/perform-unnest-inner-join-and-then-array-agg-as-part-of-an-update-query
http://amyszczepanski.com/2019/03/25/unnest-and-array-agg-respecting-order.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux