Re: Querying same lookup table with multiple columns based on another view

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>, Killian Driscoll <killiandriscoll(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Querying same lookup table with multiple columns based on another view
Date: 2015-11-17 16:12:03
Message-ID: 564B51D3.4040804@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/17/15 9:21 AM, Melvin Davidson wrote:
> Your problem is the use of SELECT *

I've often wished for a way to do *, but make changes to the results
that a normal * would give you. The two operations I've wished for are
to either remove some fields from the list, or to rename some fields.

I suspect you could create a function that would do this. You wouldn't
want to just blindly operate on a CREATE VIEW command because of things like

SELECT a.*, b.blah FROM (SELECT 1,2,3) a, b

but I think it might be possible to get the raw data out of the parser
(the grammar certainly provides it). It would probably involve C code
though.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim Nasby 2015-11-17 16:21:27 Re: referencing other INSERT VALUES columns inside the insert
Previous Message Raymond O'Donnell 2015-11-17 16:11:44 Re: Querying same lookup table with multiple columns based on another view