Re: Tricky SQL problem - retrieve information_schema info and make use of it.

From: Paul Linehan <linehanp(at)tcd(dot)ie>
To: Skylar Thompson <skylar2(at)u(dot)washington(dot)edu>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Tricky SQL problem - retrieve information_schema info and make use of it.
Date: 2016-03-22 15:09:53
Message-ID: CAF4RT5RqX2hVDTaXgKu_vS4Afwjn66-daL5+6CbTZ57ReMiVNA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> I wonder if a simpler solution would be to fix the table layout; make that
> single salesperson table that you agree would have been better.

Hi, and thanks for your input.

However, logic and clarity don't always go hand in hand with
legacy apps :-(

> Then, make
> a view on top of that for each salesperson. As of PostgreSQL 9.3, views are
> updatable---that is, they map INSERT/UPDATE/DELETE to the underlying
> table---as long as the source data of the column is unambiguous:

Yes, as you so eloquently put it, that would be great, but it's a no
can do I'm afraid!

I was thinking about doing a PIVOT on the fieldlist in the table
and then constructing an SQL string using IN(name1, name2.....).
Does this make any sense?

Paul...

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Paul Linehan 2016-03-22 15:46:02 Re: Tricky SQL problem - retrieve information_schema info and make use of it.
Previous Message Steve Crawford 2016-03-22 14:11:16 Re: Tricky SQL problem - retrieve information_schema info and make use of it.