Re: SQL objects UNITs

From: Jim Nasby <jim(at)nasby(dot)net>
To: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>, Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stephen Frost <sfrost(at)snowman(dot)net>, Jeff Davis <pgsql(at)j-davis(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Boszormenyi Zoltan <zb(at)cybertec(dot)at>, Thom Brown <thom(at)linux(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SQL objects UNITs
Date: 2013-12-18 20:19:49
Message-ID: 52B20365.1040704@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/18/13, 4:22 AM, Dimitri Fontaine wrote:
> ALTER UNIT name SET SCHEMA <new schema>;

FWIW, with the "units" that we've developed we use schemas to differentiate between public objects and "internal" (private or protected) objects. So single-schema stuff becomes a PITA. Of course, since extensions already work that way I suppose that ship has sailed, but I thought I'd mention it.

For those who are curious... we make the distinction of public/protected/private via schemas because we don't want general users to need to wade through that stuff when looking at objects. So the convention we settled on is that public objects go in one schema, protected objects go in a schema of the same name that's prepended with "_", and private objects are in the protjected schema but also prepend "_" to their names. IE:

CREATE SCHEMA awesome_feature;
CREATE VIEW awesome_feature.have_some_data

CREATE SCHEMA _awesome_feature; -- Protected / private stuff
CREATE VIEW _awesome_feature.stuff_for_database_code_to_see_but_not_users
CREATE FUNCTION _awesome_feature._do_not_run_this_function_anywhere_outside_of_awesome_feature()
--
Jim C. Nasby, Data Architect jim(at)nasby(dot)net
512.569.9461 (cell) http://jim.nasby.net

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-12-18 20:23:23 Re: shared memory message queues
Previous Message Dong Ye 2013-12-18 20:13:59 Re: 9.3 regression with dbt2