Re: [GENERAL] calling a function that takes a row type and returns a set of rows

2008-10-10 Thread Pavel Stehule
2008/10/10 Dimitri Fontaine <[EMAIL PROTECTED]>: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi, > > Le 10 oct. 08 à 21:22, Robert Haas a écrit : >> >> I can't find any legal way of calling this function. >> >> SELECT bar(f) FROM foo f; >> ERROR: set-valued function called in context tha

Re: [GENERAL] how to remove the duplicate records from a table

2008-10-10 Thread Robert Treat
On Tuesday 07 October 2008 05:48:01 Albe Laurenz wrote: > Yi Zhao wrote: > > I have a table contains some duplicate records, and this table create > > without oids, for example: > > id | temp_id > > +- > > 10 | 1 > > 10 | 1 > > 10 | 1 > > 20 | 4 > > 20 |

Re: [GENERAL] Re: [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-10 Thread Scott Marlowe
On Fri, Oct 10, 2008 at 2:23 AM, Gerfried Fuchs <[EMAIL PROTECTED]> wrote: > * Scott Marlowe <[EMAIL PROTECTED]> [2008-10-06 18:07:39 CEST]: >> On Mon, Oct 6, 2008 at 9:34 AM, Markus Wanner <[EMAIL PROTECTED]> wrote: >> > Well, it's a general Postgres problem, not a Debian one. Upgrading >> > betwe

Re: [GENERAL] calling a function that takes a row type and returns a set of rows

2008-10-10 Thread Robert Haas
> You need LATERAL support for this: > SELECT * FROM foo f LATERAL bar(f); > > I'm not sure about the syntax, but LATERAL is a standard JOIN type wherein > upper "nodes" are visible. That would be really nice. Then you could presumably also do: SELECT f.id, f.name, f.apple, f.banana, bar.apple

Re: [GENERAL] Bug In COPY TO?

2008-10-10 Thread Tom Lane
Bill Thoen <[EMAIL PROTECTED]> writes: > I noticed that in PG 8.1 the docs for COPY TO say that you can use WITH > HEADER, but when I do that it throws an error saying that this works > only in CSV mode. Is this a bug or do I have something wrong with my syntax? I'd say it's a bug in the documen

Re: [GENERAL] calling a function that takes a row type and returns a set of rows

2008-10-10 Thread Dimitri Fontaine
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Le 10 oct. 08 à 21:22, Robert Haas a écrit : I can't find any legal way of calling this function. SELECT bar(f) FROM foo f; ERROR: set-valued function called in context that cannot accept a set SELECT * FROM foo f, bar(f); ERROR: function ex

Re: [GENERAL] calling a function that takes a row type and returns a set of rows

2008-10-10 Thread Robert Haas
Hmm, the implicit cursor approach approach won't work for me because I want to be able to call the function on an arbitrary slice of the rows in the table, but the explicit cursor approach looks like it might work. I'll give that a try, thanks. ...Robert On Fri, Oct 10, 2008 at 4:01 PM, Pavel St

Re: [GENERAL] calling a function that takes a row type and returns a set of rows

2008-10-10 Thread Pavel Stehule
Hello PostgreSQL doesn't support pipe functions, so you cannot do what you wont. But you should to use SQL SETOF functions, that should be called in normal context. I dislike this feature, but it should be useful for you, try: create or replace function bar1(foo) returns setof foo as $$ selec

[GENERAL] calling a function that takes a row type and returns a set of rows

2008-10-10 Thread Robert Haas
So, say I have something like this - the actual example is something a bit more useful: CREATE TABLE foo (a integer, b integer); INSERT INTO foo VALUES (1, 1); -- must have some data to generate the failure CREATE FUNCTION bar (foo) RETURNS SETOF foo AS $$ DECLARE f foo; BEGIN f.a := 1;

Re: [GENERAL] Opteron vs. Xeon performance differences

2008-10-10 Thread postgres Emanuel CALVO FRANCO
When i question about WAL, i mean if WAL is in other drive. You must run a benchmark more expensive to cpu for make a conclusion. Make a query that have more of 8 seconds, then you can see really if exists a diference in other way... i think you don't use the same image of the old server in the n

Re: [GENERAL] Opteron vs. Xeon performance differences

2008-10-10 Thread Shane Ambler
Bart Grantham wrote: a long story short: we're experiencing Xeons as 50% slower than Opterons, even when the Xeon has twice as much cache and a slight clock speed advantage. tests I finally took the final leap: just pull the disks and throw them in a newer Opteron chassis (2.8GHz, 1M cache).

Re: [GENERAL] Opteron vs. Xeon performance differences

2008-10-10 Thread Greg Smith
On Thu, 9 Oct 2008, Bart Grantham wrote: The full story: we have an older production server with 2G of RAM, 2.4GHz Opterons w/ 1M of cache...The newer servers have 4G of RAM, 3.0GHz Xeons with 2M of cache. Model numbers please? I can probably guess for the Opterons, there are a lot of diffe

Re: [GENERAL] Opteron vs. Xeon performance differences

2008-10-10 Thread Matthew T. O'Connor
Bart Grantham wrote: Forgive me if this has been beaten into the ground, but my team and I couldn’t find much conclusive study or posts on this issue. To make a long story short: we’re experiencing Xeons as 50% slower than Opterons, even when the Xeon has twice as much cache and a slight clock

Re: [GENERAL] grabbing date of last Sunday?

2008-10-10 Thread Michael Glaesemann
On Oct 10, 2008, at 11:36 , Raymond O'Donnell wrote: On 10/10/2008 16:29, blackwater dev wrote: How can I grab the date from the last Sunday based on when I run the query? select current_date - (extract(dow from current_date) || ' days')::interval; Concatenations in math always make m

Re: [GENERAL] Improve dump and restore time

2008-10-10 Thread Guillaume Lelarge
Hi, Pascal Cohen a écrit : > I am studying how to migrate our Production Database which is running > under PG 8.2 and we would like to move to PG 8.3 > I have read that the only safe solution is to perform a dump and restore. > Our DB is around 6GB large. > I wanted to have an expectation of the m

Re: [GENERAL] Improve dump and restore time

2008-10-10 Thread Pascal Cohen
Thanks, in fact I also expected a couple of hours and I was surprised by this result. I will have a look to the hardware (unfortunately not before next week now). Thanks again. Rasper, Franz wrote: Hi, Normally it should be done in between 1 and 4 hours. Fastest version is maybe pg_dump ...

Re: [GENERAL] grabbing date of last Sunday?

2008-10-10 Thread Raymond O'Donnell
On 10/10/2008 16:29, blackwater dev wrote: > How can I grab the date from the last Sunday based on when I run the query? select current_date - (extract(dow from current_date) || ' days')::interval; :-) Ray. -- Raymond O'Donne

[GENERAL] grabbing date of last Sunday?

2008-10-10 Thread blackwater dev
How can I grab the date from the last Sunday based on when I run the query? For example I run it today, and I need to date of 10-5-08, if I ran it next week, I would want 10-12-08, etc. Thanks!

[GENERAL] Bug In COPY TO?

2008-10-10 Thread Bill Thoen
I noticed that in PG 8.1 the docs for COPY TO say that you can use WITH HEADER, but when I do that it throws an error saying that this works only in CSV mode. Is this a bug or do I have something wrong with my syntax? COPY mytable TO '/data/out.txt' WITH HEADER DELIMITER '|' NULL '' ; -- Sen

[GENERAL] Improve dump and restore time

2008-10-10 Thread Pascal Cohen
Hello, I am studying how to migrate our Production Database which is running under PG 8.2 and we would like to move to PG 8.3 I have read that the only safe solution is to perform a dump and restore. Our DB is around 6GB large. I wanted to have an expectation of the migration duration and perfor

Re: [GENERAL] Using subquery or creating temp table

2008-10-10 Thread Grzegorz Jaśkiewicz
temporary tables make sens, if you want to operate on multiple queries in the same connection.Also, temporary tables are visible only to the connection, if multiple connections will create temp table by the same name - they all will see their own content, ie - it is not shared between connections.

Re: [GENERAL] left join conditon causes error

2008-10-10 Thread Scott Marlowe
2008/10/8 Andrus <[EMAIL PROTECTED]>: > Query Query deleted for brevity > ERROR: invalid reference to FROM-clause entry for table "destkonto" > LINE 7: ... =sihrkurs.kuupaev AND sihrkurs.raha=destkonto >^ > HINT: There

Re: [GENERAL] Opteron vs. Xeon performance differences

2008-10-10 Thread postgres Emanuel CALVO FRANCO
How do you manage the wal in both servers? The version kernel is the same in both? Runs the same services? Do you make some test with Posgresql only in both servers? If the problem is the inter-CPU, i know you can specified the number of processors do you want to run dedicated to one process. 200

Re: [GENERAL] Question about hstore

2008-10-10 Thread Tom Lane
Ivan Pavlov <[EMAIL PROTECTED]> writes: > So my question is: what is the difference between hstore and ghstore? AFAICS ghstore is the storage type used in gist indexes for hstore columns. Presumably it's not documented because it's not useful for user purposes. regards, t

Re: [GENERAL] Opteron vs. Xeon performance differences

2008-10-10 Thread Scott Marlowe
On Thu, Oct 9, 2008 at 3:34 PM, Bart Grantham <[EMAIL PROTECTED]> wrote: > Forgive me if this has been beaten into the ground, but my team and I > couldn't find much conclusive study or posts on this issue. To make a long > story short: we're experiencing Xeons as 50% slower than Opterons, even wh

Re: [GENERAL] GROUP BY does not follow SQL standard

2008-10-10 Thread Scott Marlowe
On Thu, Oct 9, 2008 at 8:01 AM, Tony Marston <[EMAIL PROTECTED]> wrote: > The Postgresql implementation of GROUP BY does not conform to either the > 1999 or 2003 SQL standard. The documentation states that every field in the > SELECT list which is not aggregated must be specified in the GROUP BY >

[GENERAL] left join conditon causes error

2008-10-10 Thread Andrus
Query SELECT bilkaib.* FROM prpalk, (SELECT TRUE AS db, 1 AS sign UNION SELECT FALSE,-1 ) role,konto destkonto,bilkaib LEFT JOIN kurss sihrkurs ON CASE WHEN '00' IN(cr,db) THEN bilkaib.kuupaev-1 ELSE bilkaib.kuupaev END =sihrkurs.kuupaev AND sihrkurs.raha=destkonto.rah

[GENERAL] Using subquery or creating temp table

2008-10-10 Thread Andrus
Test table: CREATE TABLE t1 ( col1 int, col2 int, ... ); Subquery SELECT * FROM t1 WHERE col1=2 Is it OK to use this subquery two times in same statement or should temp table created to prevent subquery executing twice? Which is better SELECT * ( SELECT * FROM (SELECT * FROM t1 WHERE col1=2)

[GENERAL] GROUP BY does not follow SQL standard

2008-10-10 Thread Tony Marston
The Postgresql implementation of GROUP BY does not conform to either the 1999 or 2003 SQL standard. The documentation states that every field in the SELECT list which is not aggregated must be specified in the GROUP BY clause. While this was true in the 1992 standard, in 1999 this was changed t

[GENERAL] problem with check constraints

2008-10-10 Thread Anton Andreev
Hi, When I create a check constraint in PgAdmin3 1.8.4 on a Postgresql 8.3.3: ((A and B) or (C and D)) I get with create script: (A and B or C and D) which is wrong. Please help. Cheers, Anton -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subs

[GENERAL] Opteron vs. Xeon performance differences

2008-10-10 Thread Bart Grantham
Forgive me if this has been beaten into the ground, but my team and I couldn't find much conclusive study or posts on this issue. To make a long story short: we're experiencing Xeons as 50% slower than Opterons, even when the Xeon has twice as much cache and a slight clock speed advantage. The

Re: [GENERAL] [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-10 Thread Gerfried Fuchs
* Martin Pitt <[EMAIL PROTECTED]> [2008-10-10 09:49:01 CEST]: > Alexander Wirt [2008-10-10 7:02 +0200]: > > mechanized? No. > > I meant it in the sense of "run a script to create a backport from a > particular testing/unstable release, as opposed to changing any source > package and upload it ma

Re: [GENERAL] [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-10 Thread Gerfried Fuchs
* Markus Wanner <[EMAIL PROTECTED]> [2008-10-10 10:27:51 CEST]: > Gerfried Fuchs wrote: > > This is what formorer doesn't like, and honestly, as much as I would > > like to help getting things working again and support postgres users > > here, I have to agree with him. > > What solution do you ha

[GENERAL] Question about hstore

2008-10-10 Thread Ivan Pavlov
I installed the hstore module (http://www.postgresql.org/docs/current/ static/hstore.html) because I have a situation where I prefer to use hstore instead of XML. Everything works great, but I saw that after installing the module I actually have two new datatypes: hstore and ghstore. The last one

[GENERAL] Re: [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-10 Thread Alexander Wirt
Markus Wanner schrieb am Donnerstag, den 09. Oktober 2008: > Hi, > > Martin Pitt wrote: > > That's in fact the option I have most trouble with. Reason is that > > major upstream releases are roughly maintained for five years. All > > packages in Lenny main will be supported for Lenny's lifetime,

Re: [GENERAL] Re: [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-10 Thread Gerfried Fuchs
* Scott Marlowe <[EMAIL PROTECTED]> [2008-10-06 18:07:39 CEST]: > On Mon, Oct 6, 2008 at 9:34 AM, Markus Wanner <[EMAIL PROTECTED]> wrote: > > Well, it's a general Postgres problem, not a Debian one. Upgrading > > between major versions requires a full dump/restore cycle, for which the > > downtime

[GENERAL] Socket error instead of Access denied

2008-10-10 Thread Serge Fonville
One thing I forgot. The errors occur when I use psql.exe with the -U paramter -- Forwarded message -- From: Serge Fonville <[EMAIL PROTECTED]> Date: Fri, Oct 10, 2008 at 3:00 PM Subject: Fwd: Socket error instead of Access denied To: pgsql-general Sorry about that, submitted it

[GENERAL] Fwd: Socket error instead of Access denied

2008-10-10 Thread Serge Fonville
Sorry about that, submitted it to early. Here goes again: Recently I started to move from MySQL to PostgreSQL.When I had it set up on windows, I enabled ssl and everything worked like a charm. My pg_hba.conf looks like this: hostssl all postgres 127.0.0.1/32 md5 hosts

Re: [GENERAL] flood in logs

2008-10-10 Thread Tom Lane
hubert depesz lubaczewski <[EMAIL PROTECTED]> writes: > On Fri, Oct 10, 2008 at 08:42:02AM -0400, Tom Lane wrote: >> Mph, so it's an omission in the log_statement code. You must have >> log_statement set to mod or ddl on this machine. > yes. it's ddl. and on the machine that doesn't print the war

[GENERAL] Socket error instead of Access denied

2008-10-10 Thread Serge Fonville
Recently I started to move from MySQL to PostgreSQL.When I had it set up on windows, I enabled ssl and everything worked like a charm. My pg_hba.conf looks like this: hostsslallpostgres 127.0.0.1/32 md5 hostssl ticketsystem ticketsystem127.0.0.1/32md5 hostsslfaq faq 127.0.0.1/32 md5 hostssl allpo

Re: [GENERAL] flood in logs

2008-10-10 Thread hubert depesz lubaczewski
On Fri, Oct 10, 2008 at 08:42:02AM -0400, Tom Lane wrote: > Mph, so it's an omission in the log_statement code. You must have > log_statement set to mod or ddl on this machine. yes. it's ddl. and on the machine that doesn't print the warning - it's "none". I also checked current (well, from 2 da

[GENERAL] Idle in transaction connection

2008-10-10 Thread Norberto Delle
Hi all I have a Postgresql 8.2.10 install running on w2k3, and recently, or more precisely, after I upgraded from 8.2.5 to 8.2.10, some connections keep in the 'idle in transaction' state. The real problem is that even after I kill the connection subprocess, the pg_stat_activity reports that th

Re: [GENERAL] flood in logs

2008-10-10 Thread Tom Lane
hubert depesz lubaczewski <[EMAIL PROTECTED]> writes: > postgres=# DISCARD ALL; > WARNING: 01000: unrecognized node type: 742 > LOCATION: GetCommandLogLevel, utility.c:2558 > DISCARD ALL Mph, so it's an omission in the log_statement code. You must have log_statement set to mod or ddl on this ma

Re: [GENERAL] flood in logs

2008-10-10 Thread hubert depesz lubaczewski
On Fri, Oct 10, 2008 at 08:24:35AM -0400, Tom Lane wrote: > hubert depesz lubaczewski <[EMAIL PROTECTED]> writes: > > postgres=# DISCARD ALL; > > WARNING: unrecognized node type: 742 > > DISCARD ALL > Could we see that with "\set VERBOSITY verbose", please? sure: postgres=# DISCARD ALL; WARNING:

Re: [GENERAL] flood in logs

2008-10-10 Thread Tom Lane
hubert depesz lubaczewski <[EMAIL PROTECTED]> writes: > postgres=# DISCARD ALL; > WARNING: unrecognized node type: 742 > DISCARD ALL Could we see that with "\set VERBOSITY verbose", please? regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgres

Re: [GENERAL] Update Query Problem

2008-10-10 Thread A. Kretschmer
am Fri, dem 10.10.2008, um 12:38:24 +0100 mailte Jeng Yu folgendes: > Hi People! > > I'm doing an application and I've chosen postgresql > for the backend db. I need to use SQL update command > like this in my application: > > update mytable set x='20' where id='someid' order by > id limit 1;

Re: [GENERAL] flood in logs

2008-10-10 Thread hubert depesz lubaczewski
On Fri, Oct 10, 2008 at 12:58:35PM +0200, Sebastian Pawłowski wrote: > have you got any idea where do they come from? and how can i stop them? i > was trying to solve the problem, but with no result > i'm using: > Ubuntu 8.04.1 > PostgreSQL 8.3.3 on x86_64-pc-linux-gnu, compiled by GCC

[GENERAL] Update Query Problem

2008-10-10 Thread Jeng Yu
Hi People! I'm doing an application and I've chosen postgresql for the backend db. I need to use SQL update command like this in my application: update mytable set x='20' where id='someid' order by id limit 1; In other words, I want to update just one row of the table if there are more than one

Re: [GENERAL] Frustrated...pg_dump/restore

2008-10-10 Thread Marco Colombo
Jeff Amiel wrote: > Ahhh > *looks at encoding* > > Well..they are both the same...BUT...they are set to > ENCODING = 'SQL_ASCII'; > > That explains a lotthey should probably be set to Unicode UTF8 > Duh > > Any way to change encoding without dumping/restoring database? You can

[GENERAL] flood in logs

2008-10-10 Thread Sebastian Pawłowski
hi, i''m getting a lot of warning lines in log file, they appears as follows: 2008-10-10 12:11:49.976 CEST [EMAIL PROTECTED] 5696 127.0.0.1(46403) WARNING: unrecognized node type: 742 2008-10-10 12:11:49.987 CEST [EMAIL PROTECTED] 5696 127.0.0.1(46403) WARNING: unrecognized node type:

Re: [GENERAL] how to get unique identifier for a client

2008-10-10 Thread Grzegorz Jaśkiewicz
I would gather all possible inputs of data that you can use for it. Will the data be stored in one place for all customers ? if so - you'll be okay with uuid of some sort, as primary key on a table. if you need data to depend on outside data, either write a query, that would generate it, taking th

[GENERAL] how to get unique identifier for a client

2008-10-10 Thread gorsa
hi all is there a way to get a unique identifier for a client? something like a machine id. session_user does not seem to work since a user can log on to many workstations. been through the list so i'm not searching for getting the ip address since the list said something like it's not supported in

[GENERAL] Re: [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-10 Thread Markus Wanner
Hi, Gerfried Fuchs wrote: > Upgrade to pg8.3, the same that users of testing would have to do. And > learn to see that backported packages are a moving target that gets > updated. The problem only exists because upgrading is not an option. There are lots of people *wanting* to stick with Postgre

[GENERAL] Re: [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-10 Thread Markus Wanner
Hi, Gerfried Fuchs wrote: > This is what formorer doesn't like, and honestly, as much as I would > like to help getting things working again and support postgres users > here, I have to agree with him. What solution do you have in mind for people who want Postgres 8.2 on debian etch (because the

[GENERAL] Re: [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-10 Thread Martin Pitt
Alexander Wirt [2008-10-10 7:02 +0200]: > > > So a compromise I can live with is to put it back into unstable (or > > > even just experimental), but never let it propagate to testing. Then > > > backports.org can do mechanized backports of updates without being > mechanized? No. I meant it in t

[GENERAL] Re: [Pkg-postgresql-public] Postgres major version support policy on Debian

2008-10-10 Thread Martin Pitt
Markus Wanner [2008-10-09 22:53 +0200]: > Can you act as a sponsor for uploading 8.2 packages to experimental or > unstable? Of course. Martin -- Martin Pitt| http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org) -- Sent via pgsql-