[GENERAL] Why security-definer functions are executable by public by default?

2011-04-05 Thread hubert depesz lubaczewski
hi was pointed to the fact that security definer functions have the same default privileges as normal functions in the same language - i.e. if the language is trusted - public has the right to execute them. maybe i'm missing something important, but given the fact that security definer functions

Re: [GENERAL] Why security-definer functions are executable by public by default?

2011-04-05 Thread Sim Zacks
On 04/05/2011 09:41 AM, hubert depesz lubaczewski wrote: hi was pointed to the fact that security definer functions have the same default privileges as normal functions in the same language - i.e. if the language is trusted - public has the right to execute them. maybe i'm missing something

[GENERAL] Integrating New Data Type

2011-04-05 Thread Nick Raj
Hi all, I have defined a new data type. I have defined in and out function for that data type. But i want to know how to integrate this data type with postgres (how postgres compile my code or know my datatype) ? Thanks, Nirmesh

Re: [GENERAL] Integrating New Data Type

2011-04-05 Thread Pavel Stehule
Hello 2011/4/5 Nick Raj nickrajj...@gmail.com: Hi all, I have defined a new data type. I have defined in and out function for that data type. But i want to know how to integrate this data type with postgres (how postgres compile my code or know my datatype) ? you have to register in, out

[GENERAL] Database gnu make equivalent

2011-04-05 Thread pasman pasmański
Hello. I search a tool to send queries to database when specific rows contain null or not exist. What can be used for this purpose ? pasman -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] Database gnu make equivalent

2011-04-05 Thread Gabriele Bartolini
Hi Pasman, On Tue, 5 Apr 2011 11:14:16 +0200, pasman pasmański pasma...@gmail.com wrote: I search a tool to send queries to database when specific rows contain null or not exist. What can be used for this purpose ? Could you please elaborate this and provide us with more information? I am

[GENERAL] Named advisory locks

2011-04-05 Thread rihad
Hi, all. I'm looking for a way to lock on an arbitrary string, just how MySQL allows doing with GET_LOCK('foo.123') / RELEASE_LOCK('foo.123'). I know that at least Postgres 8.3 has pg_advisory_lock() / pg_advisory_unlock() but they seem to accept integer values only, and we're already using

Re: [GENERAL] Database gnu make equivalent

2011-04-05 Thread John R Pierce
On 04/05/11 2:14 AM, pasman pasmański wrote: Hello. I search a tool to send queries to database when specific rows contain null or not exist. What can be used for this purpose ? A perl script, perhaps? You would of course have to make a query to determine that the specific row you are

[GENERAL] Out of memory

2011-04-05 Thread Jeremy Palmer
Hi, I've been having repeated troubles trying to get a PostgreSQL app to play nicely on Ubuntu. I recently posted a message on this list about an out of memory error and got a resolution by reducing the work_mem setting. However I'm now getting further out of memory issues during the same

Re: [GENERAL] PostgreSQL documentation on kindle - best practices?

2011-04-05 Thread ray
On Apr 4, 4:00 am, jayadevan.maym...@ibsplc.com (Jayadevan M) wrote: So my question: has anyone found a best practice solution to convert the PostgreSQL documentaiton into a kindle-friendly format? Or has even an .azw file downloadable somewhere? Best wishes, Harald You could always

Re: [GENERAL] schema access privs

2011-04-05 Thread Vibhor Kumar
[ Please don't overpost the list. Adding PG General List] On Apr 5, 2011, at 3:30 AM, Ray Stell wrote: On Tue, Apr 05, 2011 at 02:42:30AM +0530, Vibhor Kumar wrote: On Apr 5, 2011, at 2:31 AM, Ray Stell wrote: What does the results in col 'List of schemas Access privileges' indicate?

[GENERAL] Trigger vs web service

2011-04-05 Thread Marc-André Goderre
I receive a long string (about 1 per second) than content many information. For the moment it is directly inserted in the database (1 column). I have to treat the hole string every time i need information in it. Now, I want split the sting and save the informations in differents fields. I have

Re: [GENERAL] schema access privs

2011-04-05 Thread Ray Stell
On Tue, Apr 05, 2011 at 03:58:46PM +0530, Vibhor Kumar wrote: Following are details: postgres=UC/postgres+ [user] [privs] /[ ROLE who granted privs. What's the logic for reporting the U priv twice? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes

Re: [GENERAL] schema access privs

2011-04-05 Thread Vibhor Kumar
On Apr 5, 2011, at 6:07 PM, Ray Stell wrote: On Tue, Apr 05, 2011 at 03:58:46PM +0530, Vibhor Kumar wrote: Following are details: postgres=UC/postgres+ [user] [privs] /[ ROLE who granted privs. What's the logic for reporting the U priv twice? If you are talking about following:

Re: [GENERAL] Named advisory locks

2011-04-05 Thread Craig Ringer
On 5/04/2011 5:42 PM, rihad wrote: Hi, all. I'm looking for a way to lock on an arbitrary string, just how MySQL allows doing with GET_LOCK('foo.123') / RELEASE_LOCK('foo.123'). I know that at least Postgres 8.3 has pg_advisory_lock() / pg_advisory_unlock() but they seem to accept integer values

[GENERAL] Memory leak in SPI_finish call

2011-04-05 Thread Jorge Arévalo
Hello, I'm having problems with a PostgreSQL server side C-function. It's not an aggregate function (operates over a only row of data). When the function is called over tables with ~4000 rows, it causes postgres backend crash with SEGFAULT. I know the error is a kind of cumulative, because with

Re: [GENERAL] Foreign key and locking problem

2011-04-05 Thread Vick Khera
On Mon, Apr 4, 2011 at 4:18 PM, Edoardo Serra edoa...@serra.to.it wrote: At this point, client1 gives the following error: ERROR: could not serialize access due to concurrent update CONTEXT: SQL statement SELECT 1 FROM ONLY public.people x WHERE id OPERATOR(pg_catalog.=) $1 FOR SHARE OF x

Re: [GENERAL] Plpgsql function to compute every other Friday

2011-04-05 Thread Merlin Moncure
On Mon, Apr 4, 2011 at 7:12 PM, C. Bensend be...@bennyvision.com wrote: Hey folks,   So, I'm working on a little application to help me with my budget.  Yeah, there are apps out there to do it, but I'm having a good time learning some more too.  :)   I get paid every other Friday.  I

Re: [GENERAL] Trigger vs web service

2011-04-05 Thread Jorge Godoy
If I was Yoda, I would say The answer you seek is... it depends If I were you, I would test both solutions and check which one performs better and impacts the least on your environment. For example, if you have no logic at all on the database then I would code that in the frontend. If you have

Re: [GENERAL] Named advisory locks

2011-04-05 Thread rihad
On 5/04/2011 5:42 PM, rihad wrote: Hi, all. I'm looking for a way to lock on an arbitrary string, just how MySQL allows doing with GET_LOCK('foo.123') / RELEASE_LOCK('foo.123'). I know that at least Postgres 8.3 has pg_advisory_lock() / pg_advisory_unlock() but they seem to

Re: [GENERAL] Why security-definer functions are executable by public by default?

2011-04-05 Thread Tom Lane
hubert depesz lubaczewski dep...@depesz.com writes: was pointed to the fact that security definer functions have the same default privileges as normal functions in the same language - i.e. if the language is trusted - public has the right to execute them. maybe i'm missing something

Re: [GENERAL] schema access privs

2011-04-05 Thread Ray Stell
On Tue, Apr 05, 2011 at 06:33:46PM +0530, Vibhor Kumar wrote: On Apr 5, 2011, at 6:07 PM, Ray Stell wrote: On Tue, Apr 05, 2011 at 03:58:46PM +0530, Vibhor Kumar wrote: Following are details: postgres=UC/postgres+ [user] [privs] /[ ROLE who granted privs. What's the logic

Re: [GENERAL] Named advisory locks

2011-04-05 Thread Ben Chobot
On Apr 5, 2011, at 7:35 AM, rihad wrote: No, what I meant was that we're already using ints for a different purpose in another app on the same server, so I cannot safely reuse them. Aren't advisory lock ID's unique across the whole server? The sole purpose of the string ID is to be able

Re: [GENERAL] Named advisory locks

2011-04-05 Thread rihad
On 04/05/2011 08:29 PM, Ben Chobot wrote: On Apr 5, 2011, at 7:35 AM, rihad wrote: No, what I meant was that we're already using ints for a different purpose in another app on the same server, so I cannot safely reuse them. Aren't advisory lock ID's unique across the whole server? The sole

Re: [GENERAL] Named advisory locks

2011-04-05 Thread Vick Khera
On Tue, Apr 5, 2011 at 10:35 AM, rihad ri...@mail.ru wrote: No, what I meant was that we're already using ints for a different purpose in another app on the same server, so I cannot safely reuse them. Aren't advisory lock ID's unique across the whole server? The sole purpose of the string ID

[GENERAL] Seeking Postgres users, DBAs and developers in areas where we don't have conferences or user groups

2011-04-05 Thread Selena Deckelmann
Hi! I'm trying to find people who use, administrate or develop PostgreSQL and live in regions that our community doesn't currently serve. By doesn't currently serve, I mean that: * You don't know many other people that use PostgreSQL in your town, nearby city or country, * You've never been to

[GENERAL] Is index rebuilt upon updating table with the same values as already existing in the table?

2011-04-05 Thread Zeev Ben-Sender
Hi, Having the update statement like this: UPDATE my_table SET (COL1 = '05cf5219-38e6-46b6-a6ac-5bbc3887d16a', COL2 = 28) WHERE COL3 = 35; Will this statement result indexes rebuild if COL1 and COL2 already equal '05cf5219-38e6-46b6-a6ac-5bbc3887d16a' and 28? Thank you

Re: [GENERAL] ..horribly documented, inefficient, user-hostile, impossible to maintain interpreted language..

2011-04-05 Thread Merlin Moncure
On Mon, Apr 4, 2011 at 2:20 PM, John R Pierce pie...@hogranch.com wrote: On 04/04/11 12:07 PM, Martin Gainty wrote: ..horribly documented, inefficient, user-hostile, impossible to maintain interpreted language.. to whom might you be alluding to I only used a few of those adjectives, and

[GENERAL] Problem with multiple action rule on modifiable view

2011-04-05 Thread Chris Oldfield
Hi, I'm trying to implement a modifiable view and have run into a road block. A DELETE rule attached to my view refuses to execute any commands after the first delete on one of views the component tables. Examining the output of EXPLAIN, it seems that the view is constructed for every action

Re: [GENERAL] Is index rebuilt upon updating table with the same values as already existing in the table?

2011-04-05 Thread Vick Khera
On Tue, Apr 5, 2011 at 11:22 AM, Zeev Ben-Sender ze...@checkpoint.comwrote: Hi, Having the update statement like this: UPDATE my_table SET (COL1 = ‘05cf5219-38e6-46b6-a6ac-5bbc3887d16a’, COL2 = 28) WHERE COL3 = 35; Will this statement result indexes rebuild if COL1 and COL2 already

Re: [GENERAL] Plpgsql function to compute every other Friday

2011-04-05 Thread C. Bensend
By making this function sql and immutable, you give the database more ability to inline it into queries which can make a tremendous performance difference in some cases. You can also index based on it which can be useful. Very nice, Merlin. These aren't really a concern in my case as I'm

Re: [GENERAL] ..horribly documented, inefficient, user-hostile, impossible to maintain interpreted language..

2011-04-05 Thread John R Pierce
On 04/05/11 9:40 AM, Merlin Moncure wrote: On Mon, Apr 4, 2011 at 2:20 PM, John R Piercepie...@hogranch.com wrote: I only used a few of those adjectives, and prefixed them by hypothetical. to be honest, I would expect most languages commonly used in web service environments to be more

Re: [GENERAL] ..horribly documented, inefficient, user-hostile, impossible to maintain interpreted language..

2011-04-05 Thread Merlin Moncure
On Tue, Apr 5, 2011 at 1:04 PM, John R Pierce pie...@hogranch.com wrote: On 04/05/11 9:40 AM, Merlin Moncure wrote: On Mon, Apr 4, 2011 at 2:20 PM, John R Piercepie...@hogranch.com  wrote: I only used a few of those adjectives, and prefixed them by hypothetical. to be honest, I would expect

Re: [GENERAL] Named advisory locks

2011-04-05 Thread rihad
On Tue, Apr 5, 2011 at 10:35 AM, rihad rihad(at)mail(dot)ru wrote: No, what I meant was that we're already using ints for a different purpose in another app on the same server, so I cannot safely reuse them. Aren't advisory lock ID's unique across the whole server? The sole purpose of the

Re: [GENERAL] Out of memory

2011-04-05 Thread Jeff Davis
On Tue, 2011-04-05 at 21:50 +1200, Jeremy Palmer wrote: Hi, I've been having repeated troubles trying to get a PostgreSQL app to play nicely on Ubuntu. I recently posted a message on this list about an out of memory error and got a resolution by reducing the work_mem setting. However I'm

Re: [GENERAL] Named advisory locks

2011-04-05 Thread Vick Khera
On Tue, Apr 5, 2011 at 2:49 PM, rihad ri...@mail.ru wrote: Can't do that, because I'm simply using some table's serial value as the lock ID, which is itself a bigint. So you assigned the entire namespace to the other purpose seems to be programmer's bad planning :(

Re: [GENERAL] Named advisory locks

2011-04-05 Thread rihad
On 04/06/2011 12:20 AM, Vick Khera wrote: On Tue, Apr 5, 2011 at 2:49 PM, rihad ri...@mail.ru mailto:ri...@mail.ru wrote: Can't do that, because I'm simply using some table's serial value as the lock ID, which is itself a bigint. So you assigned the entire namespace to the other

Re: [GENERAL] Out of memory

2011-04-05 Thread John R Pierce
On 04/05/11 2:50 AM, Jeremy Palmer wrote: I've been having repeated troubles trying to get a PostgreSQL app to play nicely on Ubuntu. I recently posted a message on this list about an out of memory error and got a resolution by reducing the work_mem setting. However I'm now getting further

[GENERAL] unique amount more than one table

2011-04-05 Thread Perry Smith
I have five tables each with a name field. Due to limitations in my user interface, I want a name to be unique amoung these five tables. I thought I could first create a view with something like: SELECT name, 'table1' as type from table1 UNION ALL SELECT name, 'table2' as type from table2

Re: [GENERAL] unique amount more than one table

2011-04-05 Thread Jeff Davis
On Tue, 2011-04-05 at 17:02 -0500, Perry Smith wrote: CREATE OR REPLACE FUNCTION unique_xxx ( ) RETURNS boolean AS $$ SELECT ( SELECT max(cnt) FROM ( SELECT count(*) AS cnt FROM xxx GROUP BY name ) AS foo ) = 1; $$ LANGUAGE SQL; Next I added a check constraint with: ALTER TABLE

Re: [GENERAL] unique amount more than one table

2011-04-05 Thread David Johnston
You can try restricting all name insertions (on any of the tables) to go through one or more functions that serialize amongst themselves. Basically lock a common table and check the view for the new name before inserting. On Apr 5, 2011, at 18:02, Perry Smith pedz...@gmail.com wrote: I have

Re: [GENERAL] Out of memory

2011-04-05 Thread Jeremy Palmer
Hi John, Does that all really have to be a single transaction? Yes - I need to ensure that of the changesets and denormalised tables are created in the same transaction, so that if an error occurs the database is rolled back to the last successfully applied changeset. I don't want to get

Re: [GENERAL] unique amount more than one table

2011-04-05 Thread Rob Sargent
On 04/05/2011 04:02 PM, Perry Smith wrote: I have five tables each with a name field. Due to limitations in my user interface, I want a name to be unique amoung these five tables. I thought I could first create a view with something like: SELECT name, 'table1' as type from table1 UNION

[GENERAL] Dumping functions with pg_dump

2011-04-05 Thread Greg Corradini
Hello, Is it possible yet in 8.4 to pg_dump specific functions without having to do the whole pg_restore thing? If it is possible, what is the syntax to dump a specific function? If not possible, then how does one use pg_restore to target a specific function? thx

Re: [GENERAL] Dumping functions with pg_dump

2011-04-05 Thread Raymond O'Donnell
On 06/04/2011 00:15, Greg Corradini wrote: Hello, Is it possible yet in 8.4 to pg_dump specific functions without having to do the whole pg_restore thing? If I understand correctly what you're trying to do, a handy alternative is to use pgAdmin, right click on the function in the tree view,

Re: [GENERAL] Dumping functions with pg_dump

2011-04-05 Thread Greg Corradini
Thanks for the reply Raymond! This is all through remote terminal so I can't use pg_admin ;( Maybe some more quick context I don't want to dump whole database b/c the thing is 12GB and for the application we're building we only access certain tables in the DB. There's one table that has two

Re: [GENERAL] Dumping functions with pg_dump

2011-04-05 Thread Jerry Sievers
Greg Corradini gregcorrad...@gmail.com writes: Hello, Is it possible yet in 8.4 to pg_dump specific functions without having to do the whole pg_restore thing? If it is possible, what is the syntax to dump a specific function? If not possible, then how does one use pg_restore to target a

Re: [GENERAL] Dumping functions with pg_dump

2011-04-05 Thread Adrian Klaver
On Tuesday, April 05, 2011 4:19:56 pm Raymond O'Donnell wrote: On 06/04/2011 00:15, Greg Corradini wrote: Hello, Is it possible yet in 8.4 to pg_dump specific functions without having to do the whole pg_restore thing? If I understand correctly what you're trying to do, a handy

Re: [GENERAL] unique amount more than one table

2011-04-05 Thread Perry Smith
On Apr 5, 2011, at 5:50 PM, Rob Sargent wrote: On 04/05/2011 04:02 PM, Perry Smith wrote: I have five tables each with a name field. Due to limitations in my user interface, I want a name to be unique amoung these five tables. I thought I could first create a view with something

Re: [GENERAL] Dumping functions with pg_dump

2011-04-05 Thread Greg Corradini
On Tue, Apr 5, 2011 at 4:30 PM, Adrian Klaver adrian.kla...@gmail.comwrote: On Tuesday, April 05, 2011 4:19:56 pm Raymond O'Donnell wrote: On 06/04/2011 00:15, Greg Corradini wrote: Hello, Is it possible yet in 8.4 to pg_dump specific functions without having to do the whole

Re: [GENERAL] Dumping functions with pg_dump

2011-04-05 Thread Adrian Klaver
On Tuesday, April 05, 2011 5:24:13 pm Greg Corradini wrote: On Tue, Apr 5, 2011 at 4:30 PM, Adrian Klaver adrian.kla...@gmail.comwrote: Thx for the replies Adrian and Jerry, Those are both options. Jerry, your suggestion is the work around I've already used. Adrian, I did not know you

Re: [GENERAL] Out of memory

2011-04-05 Thread Jeremy Palmer
Hi Jeff, Where is the source to the function?  The source is located here: https://github.com/linz/linz_bde_uploader The main function LDS_MaintainSimplifiedLayers that is being called is on line 37 is in https://github.com/linz/linz_bde_uploader/blob/master/sql/lds_layer_functions.sql.