Re: [GENERAL] how to start a procedure after postgresql started.

2011-05-21 Thread John R Pierce
On 05/21/11 10:41 PM, Darren Duncan wrote: Well, if you can run a stored procedure automatically when Postgres starts, that looks like a necessary step to being able to implement an entire application inside Postgres. Starting Postgres is running the application. The analogy is that Postgres

Re: [GENERAL] how to start a procedure after postgresql started.

2011-05-21 Thread Scott Marlowe
On Sat, May 21, 2011 at 10:57 PM, jun yang wrote: > now all the question: > 1.how start a procedure or a script after postgresql start. Do you need this stored procedure or script to always run at pg database start? Or every time a client connects to the database? Or every minute, or every hou

Re: [GENERAL] how to start a procedure after postgresql started.

2011-05-21 Thread Darren Duncan
Pavel Stehule wrote: Hello 2011/5/22 jun yang : now all the question: 1.how start a procedure or a script after postgresql start. 2.how to get notify when a table created. 3.how to get notify when a database created. Probably it isn't possible with Pg 9.0 and older. Maybe it is possible with

Re: [GENERAL] how to start a procedure after postgresql started.

2011-05-21 Thread Pavel Stehule
Hello 2011/5/22 jun yang : > now all the question: > 1.how start a procedure or a script after postgresql start. > 2.how to get notify when a table created. > 3.how to get notify when a database created. > Probably it isn't possible with Pg 9.0 and older. Maybe it is possible with callbacks for S

[GENERAL] how to start a procedure after postgresql started.

2011-05-21 Thread jun yang
now all the question: 1.how start a procedure or a script after postgresql start. 2.how to get notify when a table created. 3.how to get notify when a database created. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresq

Re: [GENERAL] counterintuitive behaviour in pl/pgsql

2011-05-21 Thread Michael Glaesemann
On May 21, 2011, at 13:44, Pavel Stehule wrote: > 2011/5/21 Michael Glaesemann : >> >> It looks like it's just column names stomping on variable names, which is a >> known issue. This is why a lot of developers (including myself) have >> conventions of prefixing parameters and variable names (

Re: [GENERAL] understanding pg_locks

2011-05-21 Thread Ben Chobot
On May 21, 2011, at 8:53 AM, Tom Lane wrote: > Ben Chobot writes: >> We recently had an issue where a misbehaving application was running a long >> transaction that modified a bunch of rows, and this was holding up other >> transactions that wanted to do similar modifications. No surprising the

[GENERAL] Syntax Error for "boolean('value')" Type Casting

2011-05-21 Thread David Johnston
PostgreSQL 9.0.3, compiled by Visual C++ build 1500, 64-bit The following intuitively valid statement fails: SELECT boolean('true') >>SQL Error: ERROR: syntax error at or near "(" >>LINE 1: SELECT boolean('true') >> ^ The following work as expected: SELEC

Re: [GENERAL] strange type name in information_schema

2011-05-21 Thread Dan S
I'll try that . Thank you very much for your help. Best Regards Dan S 2011/5/21 Pavel Stehule > 2011/5/21 Dan S : > > > > Is there any examples of how to join the system tables to get the same > > information as I was trying to get from the function ? > > you can try to run "psql" consolewoth

Re: [GENERAL] strange type name in information_schema

2011-05-21 Thread Pavel Stehule
2011/5/21 Dan S : > > Is there any examples of how to join the system tables to get the same > information as I was trying to get from the function ? you can try to run "psql" consolewoth parameter -E, then you can see all SQL to system tables [pavel@nemesis src]$ psql -E postgres psql (9.1beta1)

Re: [GENERAL] strange type name in information_schema

2011-05-21 Thread Dan S
Is there any examples of how to join the system tables to get the same information as I was trying to get from the function ? Best Regards Dan S 2011/5/21 Pavel Stehule > 2011/5/21 Dan S : > > So is there always an underscore prepended to the type name of an array ? > > for example float[] woul

Re: [GENERAL] strange type name in information_schema

2011-05-21 Thread Pavel Stehule
2011/5/21 Dan S : > So is there always an underscore prepended to the type name of an array ? > for example float[] would then be _float right ? usually yes - this is older method for marking some type as array. Now array types are described by typelem in pg_type table. Pavel > > Best Regards >

Re: [GENERAL] strange type name in information_schema

2011-05-21 Thread Dan S
So is there always an underscore prepended to the type name of an array ? for example float[] would then be _float right ? Best Regards Dan S 2011/5/21 Pavel Stehule > Hello > > type "array of text" has name "_text" > > Regards > > Pavel Stehule > > 2011/5/21 Dan S : > > Hi ! > > > > I'm runnin

Re: [GENERAL] strange type name in information_schema

2011-05-21 Thread Pavel Stehule
Hello type "array of text" has name "_text" Regards Pavel Stehule 2011/5/21 Dan S : > Hi ! > > I'm running "PostgreSQL 9.0.2, compiled by Visual C++ build 1500, 32-bit". > > I'm trying to get type information on functions out of information_schema. > When there is an array as input or output of

[GENERAL] strange type name in information_schema

2011-05-21 Thread Dan S
Hi ! I'm running "PostgreSQL 9.0.2, compiled by Visual C++ build 1500, 32-bit". I'm trying to get type information on functions out of information_schema. When there is an array as input or output of a function I try to query information_schema of the array type. In this case udt_name gives the

Re: [GENERAL] counterintuitive behaviour in pl/pgsql

2011-05-21 Thread Pavel Stehule
2011/5/21 Michael Glaesemann : > > On May 21, 2011, at 9:41, Dan S wrote: > >> Hi ! >> >> I'm running "PostgreSQL 9.0.2, compiled by Visual C++ build 1500, 32-bit" >> >> I have found an odd behaviour in pl/pgsql when using 'return query execute' >> The function produce the dynamic query 'select * f

Re: [GENERAL] counterintuitive behaviour in pl/pgsql

2011-05-21 Thread Dan S
Yes throwing an error would probably be good to catch these kind of mistakes which silently gives you the wrong answer otherwise. Best Regards Dan S 2011/5/21 Tom Lane > Dan S writes: > > And yes I do know that I can fix the problem by renaming the output > column > > to something else than i

Re: [GENERAL] understanding pg_locks

2011-05-21 Thread Tom Lane
Ben Chobot writes: > We recently had an issue where a misbehaving application was running a long > transaction that modified a bunch of rows, and this was holding up other > transactions that wanted to do similar modifications. No surprising there. > But what I'm unclear of is how this was show

Re: [GENERAL] counterintuitive behaviour in pl/pgsql

2011-05-21 Thread Michael Glaesemann
On May 21, 2011, at 9:41, Dan S wrote: > Hi ! > > I'm running "PostgreSQL 9.0.2, compiled by Visual C++ build 1500, 32-bit" > > I have found an odd behaviour in pl/pgsql when using 'return query execute' > The function produce the dynamic query 'select * from tbl1 where col1 < 4' > and executes

Re: [GENERAL] counterintuitive behaviour in pl/pgsql

2011-05-21 Thread Tom Lane
Dan S writes: > And yes I do know that I can fix the problem by renaming the output column > to something else than i , I'm just curious about the behaviour and if it > should work like this and why. > CREATE OR REPLACE FUNCTION dynamic_query(i int) RETURNS TABLE (i int) as $$ This should probab

Re: [GENERAL] counterintuitive behaviour in pl/pgsql

2011-05-21 Thread Björn Häuser
Hello, seems like you cannot name your input parameters the same as your tableoutputcolumns? Rename one of them and it works. Something like: RETURNS TABLE (j int) Regards Am 21.05.11 16:25, schrieb Pavel Stehule: Hello yes, this behave is strange, and should be fixed Regards Pavel Steh

[GENERAL] understanding pg_locks

2011-05-21 Thread Ben Chobot
We recently had an issue where a misbehaving application was running a long transaction that modified a bunch of rows, and this was holding up other transactions that wanted to do similar modifications. No surprising there. But what I'm unclear of is how this was showing up in pg_locks. The bloc

Re: [GENERAL] counterintuitive behaviour in pl/pgsql

2011-05-21 Thread Pavel Stehule
Hello yes, this behave is strange, and should be fixed Regards Pavel Stehule 2011/5/21 Dan S : > Hi ! > > I'm running "PostgreSQL 9.0.2, compiled by Visual C++ build 1500, 32-bit" > > I have found an odd behaviour in pl/pgsql when using 'return query execute' > The function produce the dynamic

Re: [GENERAL] length of return value of to_char()

2011-05-21 Thread Seb
On Sat, 21 May 2011 02:12:13 -0400, Michael Glaesemann wrote: [...] > There's a preceeding space: [...] Thanks! Good to have quote_literal in mind for this. -- Seb -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postg

[GENERAL] counterintuitive behaviour in pl/pgsql

2011-05-21 Thread Dan S
Hi ! I'm running "PostgreSQL 9.0.2, compiled by Visual C++ build 1500, 32-bit" I have found an odd behaviour in pl/pgsql when using 'return query execute' The function produce the dynamic query 'select * from tbl1 where col1 < 4' and executes it. I would have expected to have 3 rows back with the