Обсуждение: Questions on stored-procedure best practices

Поиск
Список
Период
Сортировка

Questions on stored-procedure best practices

От
Eric Brown
Дата:
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

Re: Questions on stored-procedure best practices

От
Karsten Hilbert
Дата:
> 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?
GnuMed uses *.sql and we haven't had anyone wondering about it
if that's an indicator of it having immediate appeal.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346