Questions on stored-procedure best practices

From: Eric Brown <eric(dot)brown(at)propel(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Questions on stored-procedure best practices
Date: 2004-12-10 22:59:21
Message-ID: 20FDA8A8-4AFF-11D9-BE63-000A95C7176C@propel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm used to writing C/Java/python type stuff and am a bit new to stored
procedures and looking for a few best practices. I'm using plpgsql (as
opposed to plpython, etc.) because it offers the most flexibility in
terms of data-types, etc.

good editor:
Usually emacs does a good job, but postgres puts a stored procedure
between ' and ' and this turns off any font-lock highlighting for the
entire stored procedure. Can I use something other than quotes or fix
this somehow? Is there a better editor?

preprocessor:
I saw one reference to people running stuff through the C-preprocessor
before importing into their DB. Is this common practice? I don't see a
huge benefit for it yet unless I want to support multiple DBs.

file-names:
I know it doesn't matter, but mostly it seems to make sense to put
stuff in .sql files. I've seen some reference to people putting stuff
in .sp files. What works best for people in terms of organization?

packages:
I saw there was a patch to support oracle-style packages in postgres
back in ~2001, but I saw nothing else. Is this planned? I imagine I
could use 'schemas', but I don't think this lets me share variables and
I think these are more for splitting up table name-spaces than for
associating a group of functions.

other:
Any other suggestions?

Thanks.

Eric Brown
408-571-6341
www.propel.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Beau Hartshorne 2004-12-10 23:12:32 Re: postgresql and javascript
Previous Message Alvaro Herrera 2004-12-10 22:56:57 Re: Shared disk