Name spacing functions and stored procedures

Started by Tim Uckunabout 11 years ago9 messagesgeneral
Jump to latest
#1Tim Uckun
timuckun@gmail.com

What do you guys do to namespace your functions so that they are not
jumbled in with the system functions and also somewhat hierarchically
organized.

Obviously it's possible to create schemas for different namespaces but that
can lead to a lot of schemas which hold no data. The other way is to
simply name your functions like _lib_etl_csv_import_weird_data_format but
that's not too much fun either.

Just curious how other people deal with the issue.

#2Tony Dare
wadedare4703@comcast.net
In reply to: Tim Uckun (#1)
Re: Name spacing functions and stored procedures

I don't understand. What is wrong with having a schema which holds no data? Schemas are cheap.

----- Original Message -----

From: "Tim Uckun" <timuckun@gmail.com>
To: "pgsql-general" <pgsql-general@postgresql.org>
Sent: Wednesday, March 18, 2015 6:56:55 PM
Subject: [GENERAL] Name spacing functions and stored procedures

What do you guys do to namespace your functions so that they are not jumbled in with the system functions and also somewhat hierarchically organized.

Obviously it's possible to create schemas for different namespaces but that can lead to a lot of schemas which hold no data. The other way is to simply name your functions like _lib_etl_csv_import_weird_data_format but that's not too much fun either.

Just curious how other people deal with the issue.

#3David G. Johnston
david.g.johnston@gmail.com
In reply to: Tony Dare (#2)
Re: Name spacing functions and stored procedures

On Wednesday, March 18, 2015, WadeDare4703 <wadedare4703@comcast.net> wrote:

I don't understand. What is wrong with having a schema which holds no
data? Schemas are cheap.

------------------------------
*From: *"Tim Uckun" <timuckun@gmail.com
<javascript:_e(%7B%7D,'cvml','timuckun@gmail.com');>>
*To: *"pgsql-general" <pgsql-general@postgresql.org
<javascript:_e(%7B%7D,'cvml','pgsql-general@postgresql.org');>>
*Sent: *Wednesday, March 18, 2015 6:56:55 PM
*Subject: *[GENERAL] Name spacing functions and stored procedures

What do you guys do to namespace your functions so that they are not
jumbled in with the system functions and also somewhat hierarchically
organized.

Obviously it's possible to create schemas for different namespaces but
that can lead to a lot of schemas which hold no data. The other way is to
simply name your functions like _lib_etl_csv_import_weird_data_format but
that's not too much fun either.

Just curious how other people deal with the issue.

Create an extension?

Barring that a dedicated schema without user data has desirable properties
whether you manage it manually or via an extension. The former ways allows
you to write a migration script using drop schema and install everything
from scratch. While not useable in all cases it can be done.

I do wish schemas had some additional properties, like being able to
readily specify (if not enforce) private versus public functions, for
visibility during schema browsing, or creating a hierarchy which too would
be visible in browsing. This is what I think you are wishing for as well.
Something like Java packages.

I think you can do the naming but tooling support is non-existent and, if
it's not readily provided in core and used by psql or pgadmin it's unlikely
other tools would want to write their own.

David J.

#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: Tim Uckun (#1)
Re: Name spacing functions and stored procedures

Hi

2015-03-19 2:56 GMT+01:00 Tim Uckun <timuckun@gmail.com>:

What do you guys do to namespace your functions so that they are not
jumbled in with the system functions and also somewhat hierarchically
organized.

Obviously it's possible to create schemas for different namespaces but
that can lead to a lot of schemas which hold no data. The other way is to
simply name your functions like _lib_etl_csv_import_weird_data_format but
that's not too much fun either.

What is problem with schemas? It is tool for logical database structuring -
for tables, for functions.

I use schemas without any problems.

Show quoted text

Just curious how other people deal with the issue.

#5Tim Uckun
timuckun@gmail.com
In reply to: Pavel Stehule (#4)
Re: Name spacing functions and stored procedures

I guess I see schemas as ways to group data not functions.

It would be very nice to be able to group your code into proper modules
though. It's something I really miss.

Show quoted text
#6Thomas Kellerer
spam_eater@gmx.net
In reply to: Tim Uckun (#5)
Re: Name spacing functions and stored procedures

Tim Uckun schrieb am 19.03.2015 um 11:03:

I guess I see schemas as ways to group data not functions.

A schema is just a namespace.

The only "link" between data and a schema is that data can only live in tables and a table is associated with a namespace.

Even if you use it to "group data", you actually use to group "objects that hold data".

It would be very nice to be able to group your code into proper modules though. It's something I really miss.

An extension can be seen as a module that lives in a dedicated namespace: the schema.

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

#7Pavel Stehule
pavel.stehule@gmail.com
In reply to: Tim Uckun (#5)
Re: Name spacing functions and stored procedures

2015-03-19 11:03 GMT+01:00 Tim Uckun <timuckun@gmail.com>:

I guess I see schemas as ways to group data not functions.

It would be very nice to be able to group your code into proper modules
though. It's something I really miss.

what is advantage modules?

#8Pavel Stehule
pavel.stehule@gmail.com
In reply to: Pavel Stehule (#7)
Re: Name spacing functions and stored procedures

2015-03-19 11:46 GMT+01:00 Pavel Stehule <pavel.stehule@gmail.com>:

2015-03-19 11:03 GMT+01:00 Tim Uckun <timuckun@gmail.com>:

I guess I see schemas as ways to group data not functions.

It would be very nice to be able to group your code into proper modules
though. It's something I really miss.

what is advantage modules?

It is terrible hard to implement Oracle PL/SQL modules in Postgres due
support more than one language.

Pavel

Show quoted text
#9Steven Erickson
Steven.Erickson@telventdtn.com
In reply to: Pavel Stehule (#4)
Re: Name spacing functions and stored procedures

I’ve always used schemas – usually one for each of the business processes.

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Pavel Stehule
Sent: Thursday, March 19, 2015 12:38 AM
To: Tim Uckun
Cc: pgsql-general
Subject: Re: [GENERAL] Name spacing functions and stored procedures

Hi

2015-03-19 2:56 GMT+01:00 Tim Uckun <timuckun@gmail.com<mailto:timuckun@gmail.com>>:
What do you guys do to namespace your functions so that they are not jumbled in with the system functions and also somewhat hierarchically organized.
Obviously it's possible to create schemas for different namespaces but that can lead to a lot of schemas which hold no data. The other way is to simply name your functions like _lib_etl_csv_import_weird_data_format but that's not too much fun either.

What is problem with schemas? It is tool for logical database structuring - for tables, for functions.
I use schemas without any problems.

Just curious how other people deal with the issue.

NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.