From: Charles Clavadetscher <clavadetscher@swisspug.org>
To: 'a' <372660931@qq.com>
To: 'pgsql-general' <pgsql-general@postgresql.org>
Subject: RE: How do I select composite array element that satisfy specific conditions.
Date: Wed, 23 May 2018 13:29:12 +0200
Message-ID: <069101d3f289$4c5c38f0$e514aad0$@swisspug.org> (raw)
In-Reply-To: <tencent_56F57B4C4E55B65B7DE43183@qq.com>
References: <tencent_56F57B4C4E55B65B7DE43183@qq.com>
Hi
> -----Original Message-----
> From: a [mailto:372660931@qq.com]
> Sent: Mittwoch, 23. Mai 2018 11:43
> To: pgsql-general <pgsql-general@postgresql.org>
> Subject: How do I select composite array element that satisfy specific conditions.
>
> Hi, say if I have composite type and table
>
> create type A as(
> x float8,
> y float8
> );
>
> create table B(
> Ay A[]
> );
>
> insert into B
> values(array[
> (1,2)::A,
> (3,4)::A]
> );
>
> How could I select the element of Ay that satisfy x=3??
>
> Thank you so much!!
>
> Shore
I did not really follow this thread, so I am not in clear, why you want to complicate your life that much.
You create a custom data type and then use it in an array in a column. A complex hierarchical structure.
Why don't you simply use JSON or JSONB? Your example sounds terribly academic very much like a school assignment.
Bye
Charles
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: clavadetscher@swisspug.org, 372660931@qq.com
Subject: Re: How do I select composite array element that satisfy specific conditions.
In-Reply-To: <069101d3f289$4c5c38f0$e514aad0$@swisspug.org>
References: <tencent_56F57B4C4E55B65B7DE43183@qq.com> <069101d3f289$4c5c38f0$e514aad0$@swisspug.org>
* 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