[GENERAL] check user in group

2012-12-25 Thread Philipp Kraus
Hello, how can I check if a user is within a group? I use current_user() to get the logged-in user, but I have a group service and I need a check if the user is member of the group Thanks Phil -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] check user in group

2012-12-25 Thread Pavel Stehule
Hello you can try create or replace function is_member_of(text, text) returns boolean as $$ select exists(select rolname from pg_catalog.pg_auth_members m JOIN pg_catalog.pg_roles b ON m.roleid = b.oid where m.member = (select oid from pg_roles where rolname = $1) and rolname = $2) $$ language

[GENERAL] dataset user access

2012-12-25 Thread Philipp Kraus
Hello, I need a idea to solve the following problem: I have a table which datasets are owned by th pg login user. If the pg user is deleted, the owner of the dataset should be set to null, that means that only a super user can access to the dataset. If the username is renamed the owner of the

[GENERAL] Problem with the semantics of select into in a plpgsql function

2012-12-25 Thread Seref Arikan
Greetings, I have a plpython function that returns a set of records. I loop over them to insert them into a temp table created by another function. I wanted to test select into temp_eav_table (column) select a.column from tbl as a where approach to see if it performs better than the loop.

Re: [GENERAL] Problem with the semantics of select into in a plpgsql function

2012-12-25 Thread David Johnston
The documentation for select into covers this and provides your alternatives. http://www.postgresql.org/docs/9.2/interactive/sql-selectinto.html David J. On Dec 25, 2012, at 10:20, Seref Arikan serefari...@kurumsalteknoloji.com wrote: Greetings, I have a plpython function that returns a

Re: [GENERAL] Problem with the semantics of select into in a plpgsql function

2012-12-25 Thread Seref Arikan
David, Thanks for your response. However, I can't see my solution there. According to documentation, select into is supposed to create a new table. Create table as is offered as an alternative, but my table is already ready when I execute the statement. Maybe it is my lack of understanding, but I

Re: [GENERAL] logger table

2012-12-25 Thread Jason Dusek
2012/12/24 Philipp Kraus philipp.kr...@flashpixx.de: I need some ideas for creating a PG based logger. I have got a job, which can run more than one time. So the PK is at the moment jobid cycle number. The inserts in this table are in parallel with the same username from different host

Re: [GENERAL] Problem with the semantics of select into in a plpgsql function

2012-12-25 Thread David Johnston
SELECT INTO -- define a new table from the results of a query If the table exists use: INSERT INTO tbl (.) SELECT . David J. From: Seref Arikan [mailto:serefari...@kurumsalteknoloji.com] Sent: Tuesday, December 25, 2012 10:52 AM To: David Johnston Cc: PG-General Mailing List

Re: [GENERAL] check user in group

2012-12-25 Thread Adrian Klaver
On 12/25/2012 01:51 AM, Philipp Kraus wrote: Hello, how can I check if a user is within a group? I use current_user() to get the logged-in user, but I have a group service and I need a check if the user is member of the group In recent versions of Postgres user and group have been folded

Re: [GENERAL] Problem with the semantics of select into in a plpgsql function

2012-12-25 Thread Adrian Klaver
On 12/25/2012 07:20 AM, Seref Arikan wrote: Greetings, I have a plpython function that returns a set of records. I loop over them to insert them into a temp table created by another function. I wanted to test select into temp_eav_table (column) select a.column from tbl as a where approach to

Re: [GENERAL] logger table

2012-12-25 Thread Philipp Kraus
Am 25.12.2012 17:19, schrieb Jason Dusek: 2012/12/24 Philipp Kraus philipp.kr...@flashpixx.de: I need some ideas for creating a PG based logger. I have got a job, which can run more than one time. So the PK is at the moment jobid cycle number. The inserts in this table are in parallel with

Re: [GENERAL] Problem with the semantics of select into in a plpgsql function

2012-12-25 Thread Tom Lane
Seref Arikan serefari...@kurumsalteknoloji.com writes: I have a plpython function that returns a set of records. Is that actually plpython, or plpgsql? Because what you're showing is not legal syntax in either bare SQL or plpython, but it would act as you're reporting in plpgsql: SELECT INTO

Re: [GENERAL] Problem with the semantics of select into in a plpgsql function

2012-12-25 Thread Seref Arikan
Thanks Tom, Following David's advice, I've used insert into syntax, but got hit with a report of ambiguity of selected node. The issue was discussed here: http://archives.postgresql.org/pgsql-sql/2011-09/msg00059.php The advice here:

[GENERAL] New Zealand Postgis DBA job vacancy

2012-12-25 Thread pcreso
Mat be of interest to someone here... http://careers.eroad.co.nz/vacancies/showVacancy/11 Brent Wood

Re: [GENERAL] Simple Query Very Slow

2012-12-25 Thread Jose Martinez
Thanks for your responses. Sorry, I forgot to mention that the query actually takes 46 seconds despite what analyze (I dont quite understand the output of explain). We did perform a vacuum last Friday and it seems to help but not too much. We'll also try to recreate the indices. Here's the

Re: [GENERAL] New Zealand Postgis DBA job vacancy

2012-12-25 Thread Gavin Flower
On 25/12/12 09:46, pcr...@pcreso.com wrote: Mat be of interest to someone here... http://careers.eroad.co.nz/vacancies/showVacancy/11 Brent Wood I know some people in Auckland who do PostgreSQL, I've emailed them about it. Curiously, EROAD's head office is about an hours walk from where I