Re: [GENERAL] WITH AS vs subselect was: count (DISTINCT expression [ , ... ] ) and documentation

2008-12-26 Thread David Fetter
On Fri, Dec 26, 2008 at 07:13:48PM -0500, Tom Lane wrote: > Ivan Sergio Borgonovo writes: > >>> David Fetter wrote: > In 8.4, you'll be able to do: > > WITH d AS ( > SELECT DISTINCT c1, c2 FROM table1 > ) > SELECT count(*) FROM d; > > >>> Nice, but what will be the diff

[GENERAL] Bind message has 6 results formats but query has 5 columns

2008-12-26 Thread J Ottery
Windows XP, Using Delphi 7 ADO SQL Query Component to Drop/Delete a Column from a simple table. When I then try to query the table I get this error: "Bind message has 6 results formats but query has 5 columns" Obviously I need to refresh the connection or table but how? I have tried ADOConnectio

[GENERAL] "disappearing" rows in temp table, in recursing trigger

2008-12-26 Thread Eric Worden
Hello, I'm guessing the rows aren't really disappearing but how else to describe it? I have a trigger function that calls another function that is recursive. The recursive function creates a temp table and inserts rows into it. After the recursive function returns, the trigger function exam

Re: [GENERAL] WITH AS vs subselect was: count (DISTINCT expression [ , ... ] ) and documentation

2008-12-26 Thread Tom Lane
Ivan Sergio Borgonovo writes: >>> David Fetter wrote: In 8.4, you'll be able to do: WITH d AS ( SELECT DISTINCT c1, c2 FROM table1 ) SELECT count(*) FROM d; >>> Nice, but what will be the difference from >>> select count(*) from (select distinct c1, c2 from t); >>> ? >>

[GENERAL] WITH AS vs subselect was: count (DISTINCT expression [ , ... ] ) and documentation

2008-12-26 Thread Ivan Sergio Borgonovo
On Fri, 26 Dec 2008 12:04:48 -0800 David Fetter wrote: > On Fri, Dec 26, 2008 at 08:03:30PM +0100, Ivan Sergio Borgonovo > wrote: > > > > aggregate_name (DISTINCT expression [, expression] ) > > > In 8.4, you'll be able to do: > > > WITH d AS ( > > > SELECT DISTINCT c1, c2 FROM table1 > >

Re: [GENERAL] lack of consequence with domains and types

2008-12-26 Thread Merlin Moncure
On Fri, Dec 26, 2008 at 3:57 PM, Grzegorz Jaśkiewicz wrote: > another glance at source code, and docs tells me - that there's not > such thing as default value for custom type - unless that type is > defined as new base scalar type. So probably, that would require > postgresql to allow users to de

Re: [GENERAL] lack of consequence with domains and types

2008-12-26 Thread Grzegorz Jaśkiewicz
another glance at source code, and docs tells me - that there's not such thing as default value for custom type - unless that type is defined as new base scalar type. So probably, that would require postgresql to allow users to define default values for composite types as well, like that: create ty

Re: [GENERAL] lack of consequence with domains and types

2008-12-26 Thread Merlin Moncure
On Wed, Dec 24, 2008 at 6:41 PM, Erik Jones wrote: > > On Dec 24, 2008, at 12:04 PM, Grzegorz Jaśkiewicz wrote: > >> On Wed, Dec 24, 2008 at 6:12 PM, Erik Jones wrote: >>> >>> Yes, and columns have default values, too, which are not tied to their >>> datatype's default value (if it even has one).

Re: [GENERAL] lack of consequence with domains and types

2008-12-26 Thread Grzegorz Jaśkiewicz
I hope Tom can hear my prayers. This basically means, I won't be able to use domains+type in my designs. :/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] count (DISTINCT expression [ , ... ] ) and documentation

2008-12-26 Thread David Fetter
On Fri, Dec 26, 2008 at 08:03:30PM +0100, Ivan Sergio Borgonovo wrote: > On Fri, 26 Dec 2008 10:43:25 -0800 > David Fetter wrote: > > > On Fri, Dec 26, 2008 at 03:34:33PM +0100, Ivan Sergio Borgonovo > > wrote: > > > I noticed that starting from 8.2 the documentation at > > > http://www.postgresq

Re: [GENERAL] count (DISTINCT expression [ , ... ] ) and documentation

2008-12-26 Thread Ivan Sergio Borgonovo
On Fri, 26 Dec 2008 10:43:25 -0800 David Fetter wrote: > On Fri, Dec 26, 2008 at 03:34:33PM +0100, Ivan Sergio Borgonovo > wrote: > > I noticed that starting from 8.2 the documentation at > > http://www.postgresql.org/docs/8.2/interactive/sql-expressions.html > > say that multiple distinct expres

Re: [GENERAL] count (DISTINCT expression [ , ... ] ) and documentation

2008-12-26 Thread Pavel Stehule
2008/12/26 Ivan Sergio Borgonovo : > On Fri, 26 Dec 2008 16:23:52 +0100 > "Pavel Stehule" wrote: > >> 2008/12/26 Ivan Sergio Borgonovo : >> > On Fri, 26 Dec 2008 15:46:48 +0100 >> > "Pavel Stehule" wrote: >> > >> >> count has only one argument, >> > >> > then what was changed between 8.1 and 8.2

Re: [GENERAL] count (DISTINCT expression [ , ... ] ) and documentation

2008-12-26 Thread David Fetter
On Fri, Dec 26, 2008 at 03:34:33PM +0100, Ivan Sergio Borgonovo wrote: > I noticed that starting from 8.2 the documentation at > http://www.postgresql.org/docs/8.2/interactive/sql-expressions.html > say that multiple distinct expressions are supported > > aggregate_name (DISTINCT expression [, exp

Re: [GENERAL] count (DISTINCT expression [ , ... ] ) and documentation

2008-12-26 Thread Ivan Sergio Borgonovo
On Fri, 26 Dec 2008 16:23:52 +0100 "Pavel Stehule" wrote: > 2008/12/26 Ivan Sergio Borgonovo : > > On Fri, 26 Dec 2008 15:46:48 +0100 > > "Pavel Stehule" wrote: > > > >> count has only one argument, > > > > then what was changed between 8.1 and 8.2 to change the docs? > > None of the functions l

Re: [GENERAL] This is a limit-offset bug?

2008-12-26 Thread Emanuel Calvo Franco
2008/12/26 Martijn van Oosterhout : > On Fri, Dec 26, 2008 at 09:52:59AM -0200, Emanuel Calvo Franco wrote: >> Hi people, >> >> Yesterday when i was making some commands on 8.3.5 >> (on Centos) >> i found a rare behavior of limit offset. >> >> Try in psql: >> >> select * from foo limit 3; <- shows

Re: [GENERAL] This is a limit-offset bug?

2008-12-26 Thread Martijn van Oosterhout
On Fri, Dec 26, 2008 at 09:52:59AM -0200, Emanuel Calvo Franco wrote: > Hi people, > > Yesterday when i was making some commands on 8.3.5 > (on Centos) > i found a rare behavior of limit offset. > > Try in psql: > > select * from foo limit 3; <- shows ok > select * from foo limit3; <- shows all

Re: [GENERAL] count (DISTINCT expression [ , ... ] ) and documentation

2008-12-26 Thread Pavel Stehule
2008/12/26 Ivan Sergio Borgonovo : > On Fri, 26 Dec 2008 15:46:48 +0100 > "Pavel Stehule" wrote: > >> count has only one argument, > > then what was changed between 8.1 and 8.2 to change the docs? > None of the functions listed in: > http://www.postgresql.org/docs/8.2/static/functions-aggregate.ht

Re: [GENERAL] count (DISTINCT expression [ , ... ] ) and documentation

2008-12-26 Thread Ivan Sergio Borgonovo
On Fri, 26 Dec 2008 15:46:48 +0100 "Pavel Stehule" wrote: > count has only one argument, then what was changed between 8.1 and 8.2 to change the docs? None of the functions listed in: http://www.postgresql.org/docs/8.2/static/functions-aggregate.html seems to support aggregate(distinct exp [,exp

Re: [GENERAL] count (DISTINCT expression [ , ... ] ) and documentation

2008-12-26 Thread Pavel Stehule
Hello count has only one argument, try: postgres=# select * from fooa; a | b + 10 | 20 (1 row) postgres=# select count(distinct a,b) from fooa; ERROR: function count(integer, integer) does not exist LINE 1: select count(distinct a,b) from fooa; ^ HINT: No function ma

[GENERAL] count (DISTINCT expression [ , ... ] ) and documentation

2008-12-26 Thread Ivan Sergio Borgonovo
I noticed that starting from 8.2 the documentation at http://www.postgresql.org/docs/8.2/interactive/sql-expressions.html say that multiple distinct expressions are supported aggregate_name (DISTINCT expression [, expression] ) While previous docs just listed one: aggregate_name (DISTINCT expres

Re: [GENERAL] Compiling 8.4devel on OpenSolaris2008.11 with SunStudioExpress

2008-12-26 Thread Emanuel Calvo Franco
2008/12/24 Tom Lane : > "Emanuel Calvo Franco" writes: >> But when i want to make, i recieved an error (make and >> /opt/SunStudioExpress/bin/dmake ): >> "... >> eca...@lastchance:~/Desktop/postgresql-snapshot$ sudo make >> You must use GNU make to build PostgreSQL. > > What do you find unclear ab

[GENERAL] This is a limit-offset bug?

2008-12-26 Thread Emanuel Calvo Franco
Hi people, Yesterday when i was making some commands on 8.3.5 (on Centos) i found a rare behavior of limit offset. Try in psql: select * from foo limit 3; <- shows ok select * from foo limit3; <- shows all rows select * from foo offset1223raf3w4t4tgga; <- shows all rows select * from foo limitsd

Re: [GENERAL] Conditional commit inside functions

2008-12-26 Thread Pavel Stehule
2008/12/26 Gerhard Wiesinger : > Hello, > > Aren't there any drawbacks in postgrs on such large transaction (like in > Oracle), e.g if I would use 500.000.000 or even more? for insert no Regards Pavel > > Ciao, > Gerhard > > -- > http://www.wiesinger.com/ > > > On Fri, 26 Dec 2008, Pavel Stehule

Re: [GENERAL] get the array value?

2008-12-26 Thread Pavel Stehule
2008/12/25 Victor Nawothnig : > On Thu, Dec 25, 2008 at 7:15 AM, Charles.Hou wrote: >> name[] = { JOHN , ALEX , TEST ,""} >> >> SQL : select name from table1 where 'TEST' = any (name) >> >> return: { JOHN , ALEX , TEST } >> >> in this sql command, how can i get the index of 'TEST' is 3 ? > > First

Re: [GENERAL] Conditional commit inside functions

2008-12-26 Thread Gerhard Wiesinger
Hello, Aren't there any drawbacks in postgrs on such large transaction (like in Oracle), e.g if I would use 500.000.000 or even more? Ciao, Gerhard -- http://www.wiesinger.com/ On Fri, 26 Dec 2008, Pavel Stehule wrote: Hello why do you need commit? pavel 2008/12/26 Gerhard Wiesinger :

Re: [GENERAL] Conditional commit inside functions

2008-12-26 Thread Pavel Stehule
Hello why do you need commit? pavel 2008/12/26 Gerhard Wiesinger : > Hello! > > I tried the following, but still one transaction: > > SELECT insert_1Mio(); > > (parallel select count(id) from employee; is done) > > CREATE OR REPLACE FUNCTION insert_some(start_i INTEGER, end_i INTEGER) > RETURNS

Re: [GENERAL] Information about Pages, row versions of tables, indices

2008-12-26 Thread Pavel Stehule
2008/12/26 Gerhard Wiesinger : > Hello Pavel, > > Works fine. > > Any ideas how to optimzize the function calls to one for the output > parameters (multiple select from pgstattuple where only one part is used)? postgres=# select schemaname, tablename, table_len, dead_tuple_count from (select (pgs

Re: [GENERAL] Information about Pages, row versions of tables, indices

2008-12-26 Thread Gerhard Wiesinger
Hello Pavel, Works fine. Any ideas how to optimzize the function calls to one for the output parameters (multiple select from pgstattuple where only one part is used)? I've included some selects which might be usefull for others, too. Thnx. Ciao, Gerhard -- http://www.wiesinger.com/ -

Re: [GENERAL] Conditional commit inside functions

2008-12-26 Thread Gerhard Wiesinger
Hello! I tried the following, but still one transaction: SELECT insert_1Mio(); (parallel select count(id) from employee; is done) CREATE OR REPLACE FUNCTION insert_some(start_i INTEGER, end_i INTEGER) RETURNS void AS $func$ DECLARE BEGIN FOR i IN start_i..end_i LOOP INSERT INTO employe