[SQL] Controlling access to Sequences

2003-01-31 Thread Matthew Horoschun
Hi All, I'm implementing a system where I need to be reasonably careful about security. One thing that worries me is SEQUENCES. My understanding is that I need to GRANT the UPDATE privilege on the SEQUENCE if I want a user to be able to to use nextval() on it. The trouble is, if they can do a

Re: [SQL] Controlling access to Sequences

2003-01-31 Thread Matthew Horoschun
Hi Tom, Thanks for the response. On Saturday, February 1, 2003, at 03:09 PM, Tom Lane wrote: Matthew Horoschun <[EMAIL PROTECTED]> writes: My understanding is that I need to GRANT the UPDATE privilege on the SEQUENCE if I want a user to be able to to use nextval() on it. The trouble

Re: [SQL] Controlling access to Sequences

2003-01-31 Thread Matthew Horoschun
On Saturday, February 1, 2003, at 03:43 PM, Tom Lane wrote: Matthew Horoschun <[EMAIL PROTECTED]> writes: Should I just avoid SEQUENCES altogether and use the OIDs under normal circumstances and the MAX( id ) + 1 style thing when I need a human-usable number? I don't think so.

Re: [SQL] Inserting a tab character

2003-02-04 Thread Matthew Horoschun
Hi Luke. On Wednesday, February 5, 2003, at 02:39 PM, Luke Pascoe wrote: I have a table which defines various possible file delimiters (CHAR(1) NOT NULL), for the moment it'll only contain comma and tab. Inserting a comma is easy, but inserting a tab is proving somewhat more difficult. How d

Re: [SQL] executing a function

2003-07-08 Thread Matthew Horoschun
Hi Pawan,    CREATE FUNCTION "public"."gettesttab" () RETURNS SETOF public.testtab AS'         select * from TestTab;     'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER; You want LANGUAGE 'sql' Cheers Matthew. ---(end of broadcast)---

Re: [SQL] Logging select statements

2003-07-09 Thread Matthew Horoschun
Hi Rudi, You can't trigger on a SELECT, but you could wrap your SQL in a set returning function... http://techdocs.postgresql.org/guides/SetReturningFunctions Here is a rough and ready solution: CREATE TABLE access_log ( id int not null ); CREATE TABLE datatable ( id int not null prim

Re: [SQL] SECURITY DEFINER changes CURRENT_USER?

2003-07-19 Thread Matthew Horoschun
Hi Chris, You want to use "session_user". I would expect this to change the password of the user currently logged in but instead it changes MY password. Evidently when a function is called which is set to SECURITY DEFINER, it changes the context of the current user. The CURRENT_USER then ret