Sorry, I wasn't sure what list I should be sending this question to...
I have a multi-tenant-like application. We have a fields tree that we
call a template, with something like this:
fields(id, parent_id, name)
And several other related tables. Since we started to support multiple
templates
> SELECT id,
> (array_agg(rspid))[1] AS rspid,-- (1)
for such cases, I have created an new aggregate function:
SELECT firstnotnull(rspid) AS rspid,
this avoid to collect first all rspid values to then keep only the first one...
CREATE OR REPLACE FUNCTION public.first_agg_nn
On Wed, May 29, 2013 at 9:58 AM, Rodrigo Rosenfeld Rosas wrote:
> I know I could use a trigger, or some check constraint maybe, to ensure
> the field exists upon insert (or update), but I can't ensure the database
> will become inconsistent in case I remove a mapped field from the other
> schema.
Em 29-05-2013 12:51, Vick Khera escreveu:
On Wed, May 29, 2013 at 9:58 AM, Rodrigo Rosenfeld Rosas
mailto:rr.ro...@gmail.com>> wrote:
I know I could use a trigger, or some check constraint maybe, to
ensure the field exists upon insert (or update), but I can't
ensure the database w