Search Postgresql Archives

Re: partial JOIN (was: ID column naming convention)

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

 



On 10/25/15 2:30 AM, Rafal Pietrak wrote:
So personally, I don't see a star in a select list so harmfull, quite
the oposit.

Using * outside the database is generally very dangerous. Using it *inside* the database can be very useful, because frequently it's exactly what you want (give me all the columns, dammit!). In particular, I find it useful in views where I want the original data, along with some calculated or other values. For example,

SELECT nspname, c.oid, * FROM pg_class c LEFT JOIN pg_namespace ON...

But there's also times I've wanted a way to manipulate what * would normally do. In particular, *_except_for(field_list), and *_replace( regexp_replace to run on each field name). If those existed (and maybe a way to combine them), it wouldn't be terribly hard for you do handle your sled query with something like:

SELECT s.*, l.*( s/.*/left_%/ ), r.*( s/.*/right_& )
  FROM sled s JOIN runner l ON ... JOIN runner r ON ...
--
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


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[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 Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux