Re: [GENERAL] Strange duplicate key violation error

2007-06-29 Thread Richard Huxton
Casey Duncan wrote: There are in fact one of these tables for each schema, each one contains exactly one row (the log in the name is a bit misleading, these just contain the current replica state, not a running log). 2007-06-28 08:53:54.937 PDT [d:radio_reports_new u:slony s:4683d86f.3681 3]

Re: [GENERAL] Execution variability

2007-06-29 Thread Vincenzo Romano
On Thursday 28 June 2007 16:08:06 Alvaro Herrera wrote: Vincenzo Romano escribió: The values are here below. I suppose that the hashed ones imply a default value. Correct (widely known as commented out) By the way, it seems that the problem arises with only one query, while the other

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-29 Thread Denis Gasparin
Martijn van Oosterhout ha scritto: On Thu, Jun 28, 2007 at 11:12:19AM +0100, Bruce McAlister wrote: I just want to verify that I understand you correctly here, do you mean that the temporary table is created by specific sql, for example, create temp table, then perform some actions on that

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-29 Thread Bruce McAlister
Denis Gasparin wrote: Martijn van Oosterhout ha scritto: On Thu, Jun 28, 2007 at 11:12:19AM +0100, Bruce McAlister wrote: I just want to verify that I understand you correctly here, do you mean that the temporary table is created by specific sql, for example, create temp table, then

Re: [GENERAL] a JOIN on same table, but 'slided over'

2007-06-29 Thread Rafal Pietrak
Thank you All for this extensive help! BTW: google helps, once you know that the construct is called correlated subquery - there is no way to get an answer before one knows the question :) Thenx again! -R On Thu, 2007-06-28 at 23:23 +0530, Gurjeet Singh wrote: On 6/28/07, Alban Hertroys

[GENERAL] Create user

2007-06-29 Thread Ashish Karalkar
Hello All, I am trying to create a user and i dont understand why it is showing me any massage even after giving parameter -e to the command. command : C:\Program Files\PostgreSQL\8.2\bincreateuser ashish -S -d -R -l -P -E -e -U postgres Enter password for new role: Enter it again:

Re: [GENERAL] OFFSET and LIMIT - performance

2007-06-29 Thread Simon Riggs
On Thu, 2007-06-28 at 11:36 -0700, David Wall wrote: Network transmission costs alone would make the second way a loser. Large OFFSETs are pretty inefficient because the backend generates and discards the rows internally ... but at least it never converts them to external form or ships

Re: [GENERAL] Create user

2007-06-29 Thread A. Kretschmer
am Fri, dem 29.06.2007, um 13:31:03 +0530 mailte Ashish Karalkar folgendes: Hello All, I am trying to create a user and i dont understand why it is showing me any massage even after giving parameter -e to the command. Maybe you should use -q: -q --quiet Do not display a

Re: [GENERAL] Create user

2007-06-29 Thread Dave Page
Ashish Karalkar wrote: Hello All, I am trying to create a user and i dont understand why it is showing me any massage even after giving parameter -e to the command. command : C:\Program Files\PostgreSQL\8.2\bincreateuser ashish -S -d -R -l -P -E -e -U postgres Enter password for

Re: [GENERAL] Create user

2007-06-29 Thread Albe Laurenz
Ashish Karalkar wrote: I am trying to create a user and i dont understand why it is showing me any massage even after giving parameter -e to the command. command : C:\Program Files\PostgreSQL\8.2\bincreateuser ashish -S -d \ -R -l -P -E -e -U postgres Use -q instead of -e. Yours,

Re: [GENERAL] OFFSET and LIMIT - performance

2007-06-29 Thread Kaloyan Iliev
And what about using cursors and move. Which is faster - OFFSET/LIMIT OR CURSOR/MOVE. Best Regards, Kaloyan Iliev Tom Lane wrote: Jan Bilek [EMAIL PROTECTED] writes: I'm using PGDB with JDBC. In my app i need to select only portion of all = available rows. I know i can do it two ways:

Re: [GENERAL] AutoVacuum Behaviour Question

2007-06-29 Thread Alvaro Herrera
Bruce McAlister wrote: Denis Gasparin wrote: RESET SESSION command is available only in 8.2 branch, isn't it? I tried to issue the command in a 8.1 server and the answer was: ERROR: unrecognized configuration parameter session I had a look in our configuration and there is a session

Re: [GENERAL] Simple backup utility like mysqldump?

2007-06-29 Thread Rodrigo De León
On Jun 29, 12:32 am, Bjorn Boulder [EMAIL PROTECTED] wrote: Hello People, I'm running PostgreSQL 8.1.1 on my freebsd box. I'm curious if PostgreSQL has a utility for backing up small databases like mysqldump or Oracle's export utility. -b See:

[GENERAL] Query optimization (select single record and join)

2007-06-29 Thread Orest Kozyar
I have the following sql: CREATE OR REPLACE FUNCTION foo (in x integer) RETURNS float AS $$ SELECT max(tableB.columnC) FROM tableA inner join tableB on (tableA.columnA = tableB.columnB) WHERE tableA.columbA = x ... (additional code to select

[GENERAL] xpath_string namespace issue...

2007-06-29 Thread CG
I'm not sure what I'm missing here... :) select xpath_string($xml$?xml version=1.0 ? f:foo xmlns:f=foo f:barbaz/f:bar /f:foo $xml$ ,'//f:bar/text()') This does not give me back baz as I was expecting it to... How does one clue-in the xpath functions to the namespaces in the XML document?

Re: [GENERAL] Query optimization (select single record and join)

2007-06-29 Thread Richard Huxton
Orest Kozyar wrote: What I am wondering is whether the database first eliminate all rows in tableA that don't meet the criteria before performing the join, or does it perform the join first then eliminate all records that don't meet the criteria? If you use EXPLAIN SELECT ... then PostgreSQL

Re: [GENERAL] db replication

2007-06-29 Thread Andrew Sullivan
On Fri, Jun 29, 2007 at 03:42:32PM +0100, andrew quaresma wrote: hi.. i developing an aplication with a postgresql+postgis... i need to replicate the database to various pda, as well as insure the synchronization between all repliques... can someone with experience tell me what is the

Re: [GENERAL] CREATE FUNCTION ... performance boost?

2007-06-29 Thread Merlin Moncure
On 6/29/07, Jan Danielsson [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello all, In order to speed up commonly used queries, I use prepared statements. I assume that 'prepare' tells some database query planner to take a look at a query, and do all preparations

[GENERAL] CREATE FUNCTION ... performance boost?

2007-06-29 Thread Jan Danielsson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello all, In order to speed up commonly used queries, I use prepared statements. I assume that 'prepare' tells some database query planner to take a look at a query, and do all preparations for it, then store those preparations somewhere for

Re: [GENERAL] CREATE FUNCTION ... performance boost?

2007-06-29 Thread Merlin Moncure
On 6/29/07, Jan Danielsson [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello all, In order to speed up commonly used queries, I use prepared statements. I assume that 'prepare' tells some database query planner to take a look at a query, and do all preparations

Re: [GENERAL] CREATE FUNCTION ... performance boost?

2007-06-29 Thread Richard Huxton
Jan Danielsson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello all, In order to speed up commonly used queries, I use prepared statements. I assume that 'prepare' tells some database query planner to take a look at a query, and do all preparations for it, then store those

Re: [GENERAL] Need help with generic query

2007-06-29 Thread Jim Nasby
No idea on the function, but why not have a 'master' ticket table and have the ones in each schema inherit from it? Then you could query all tables by just querying the master table. On Jun 20, 2007, at 5:55 AM, David Abrahams wrote: Background: I have a number of schemas all of which

Re: [GENERAL] Standby servers and incrementally updated backups

2007-06-29 Thread Jim Nasby
On Jun 25, 2007, at 4:54 PM, Erik Jones wrote: On Jun 25, 2007, at 4:40 PM, Simon Riggs wrote: On Mon, 2007-06-25 at 16:00 -0500, Erik Jones wrote: On Jun 25, 2007, at 3:40 PM, Simon Riggs wrote: If I'm correct, then for large databases wherein it can take hours to take a base backup, is

Re: [GENERAL] commit transaction failed

2007-06-29 Thread Jim Nasby
I don't know about the error, but I think there's far more efficient ways to do what you're doing see below: On Jun 20, 2007, at 1:25 AM, [EMAIL PROTECTED] wrote: I m having a problem while calling the procedure in prostgresql 8.2 from adoconnection, It gets executed for some time and

Re: [GENERAL] pg_catalog.pg_get_serial_sequence() returns NULL

2007-06-29 Thread Jim Nasby
On Jun 26, 2007, at 10:28 AM, Sergey Karin wrote: I use PG 8.1.5 I execute in psql next comands: create table t_table (gid serial, name varchar); select pg_catalog.pg_get_serial_sequence('t_table', 'gid'); pg_get_serial_sequence public.t_table_gid_seq create table

Re: [GENERAL] Standby servers and incrementally updated backups

2007-06-29 Thread Erik Jones
On Jun 29, 2007, at 10:15 AM, Jim Nasby wrote: On Jun 25, 2007, at 4:54 PM, Erik Jones wrote: On Jun 25, 2007, at 4:40 PM, Simon Riggs wrote: On Mon, 2007-06-25 at 16:00 -0500, Erik Jones wrote: On Jun 25, 2007, at 3:40 PM, Simon Riggs wrote: If I'm correct, then for large databases

Re: [GENERAL] date time function

2007-06-29 Thread John D. Burger
I can't anything in the docs that explain how intervals print out. They seem to show like this: select now() - '1990-01-01'; ?column? --- 6388 days 13:06:26.3605600595 or like this: select now() - current_date; ?column? -

Re: [GENERAL] db replication

2007-06-29 Thread Hannes Dorbath
andrew quaresma wrote: i developing an aplication with a postgresql+postgis... i need to replicate the database to various pda, as well as insure the synchronization between all repliques... can someone with experience tell me what is the best free solution to my problem?... There is

Re: [GENERAL] date time function

2007-06-29 Thread Michael Glaesemann
On Jun 29, 2007, at 13:17 , John D. Burger wrote: I can't anything in the docs that explain how intervals print out. They seem to show like this: select now() - '1990-01-01'; ?column? --- 6388 days 13:06:26.3605600595 Without being anchored with a

Re: [GENERAL] date time function

2007-06-29 Thread Tom Lane
John D. Burger [EMAIL PROTECTED] writes: Why do the first and third intervals print out differently? The underlying storage is months, days, and seconds --- 1 year is the same as 12 months, but not the same as 365 days. IIRC plain timestamp subtraction produces an interval with days and seconds

Re: [GENERAL] [ADMIN] i need a rad/ide open source for work with postgresql

2007-06-29 Thread Adam Rad?owski
Look at: http://zeoslib.sourceforge.net/ Adam P.S. And remember, that You can use libpq.DLL too - the fastest way to work with PostgreSQL. Mario Jose Canto Barea pisze: why are you can make a good database relational server as postgresql 8.1, and dont make a rad/ide open source for

[GENERAL] Interval overflow?

2007-06-29 Thread Jeff Davis
Is this expected behavior or a bug? = select version(); version PostgreSQL 8.2.4 on i386-portbld-freebsd6.2, compiled by GCC cc (GCC) 3.4.6 [FreeBSD]

Re: [GENERAL] Interval overflow?

2007-06-29 Thread Michael Glaesemann
On Jun 29, 2007, at 16:07 , Jeff Davis wrote: Is this expected behavior or a bug? Bug. In general the range checking in the date time code can definitely be improved. Michael Glaesemann grzm seespotcode net ---(end of broadcast)--- TIP

Re: [GENERAL] Interval overflow?

2007-06-29 Thread Tom Lane
Michael Glaesemann [EMAIL PROTECTED] writes: On Jun 29, 2007, at 16:07 , Jeff Davis wrote: Is this expected behavior or a bug? Bug. In general the range checking in the date time code can definitely be improved. Apparently Jeff's using enable-integer-datetimes; what I see is regression=#

[GENERAL]

2007-06-29 Thread don romanos
good day webmaster. i want to ask some help from you. my problem is this. i have already installed postgres on a certain computer. i have already created tables and put necessary data in it. one day, my operating system bugged down (i am using windows xp). how could i possible retireve

Re: [GENERAL] Move a database from one server to other

2007-06-29 Thread Patrick TJ McPhee
In article [EMAIL PROTECTED], Nicholas Barr [EMAIL PROTECTED] wrote: % Only copy the data directory if both servers are offline and not running % and if both servers use the same version of postgres. This method is not % recommended AFAIK. It _is_ recommended for setting up a warm-standby server

Re: [GENERAL] growing disk usage problem: alternative solution?

2007-06-29 Thread Patrick TJ McPhee
In article [EMAIL PROTECTED], Vivek Khera [EMAIL PROTECTED] wrote: % % On Jun 26, 2007, at 3:31 PM, Bill Moran wrote: % % VACUUM FULL and REINDEX are not required to maintain disk usage. % Good old- % fashoned VACUUM will do this as long as your FSM settings are high % enough. % % % I

[GENERAL] installing pljava on windows xp

2007-06-29 Thread Pouria
Hi, When I try to install pljava 1.3 on postgresql 8.2 (or 8.1) I get an error stating that it cannot load pljava.dll from a location specificed in the config file (while the dll is clearly there). I have followed the postgredql and pljava manual installation instructions exactly with no luck.

[GENERAL] Looking for help regarding getting the latest inserted sequence value.

2007-06-29 Thread Mavinakuli, Prasanna (STSD)
Hello All, We are looking for your help.The scenarion which we need to address is,There are 2 threads and both of them are in separate transction and insert the value to a same table and also sequence number field gets incremented automotically for each of them.The problem we are facing is,We

Re: [GENERAL] Why does postgres take time to shut down sometimes?

2007-06-29 Thread Joshi, Yateen
Hi, I have an application (multi-threaded C++) on Solaris 9 platform, and it spawns approximately 18 PoostGres connections. When I try to shutdown the postgres (after the application is taken down), I have noticed that it sometimes takes more than one minute (default for 'assuming'

[GENERAL] Execution variability

2007-06-29 Thread Vincenzo Romano
Hi all. I understand this can be a ridiculous question for most you. The very same query on the very same db shows very variable timings. I'm the only one client on an unpupolated server so I'd expect a rather constant timing. INstead for a while the query become very slooow and the CPU reached

[GENERAL] table disk space usage query?

2007-06-29 Thread lawpoop
Hello all - I was looking for a way to find out how much disk space each table is using. I stumbled upon this page ( http://www.ffnn.nl/pages/articles/linux/postgresql-tips-and-tricks.php ) which gave me a query to show the number of disk pages per object. Given that a page is 8kb, I added

[GENERAL] SQL problem..

2007-06-29 Thread Bauhaus
Hello, I'm an Access/SQL novice and I have an sql problem: I have the following table Price: FuelID PriceDate Price LPG1/05/2007 0,2 LPG13/05/2007 0,21 SPS 2/05/2007 1,1 SPS 15/05/2007 1,08 And I have to make the following query: FuelID PriceDate_from PriceDate_To Price

Re: [GENERAL] LC_CTYPE and matching accented chars

2007-06-29 Thread Martin Langhoff
Alvaro Herrera wrote: Martin Langhoff wrote: # this is apparently the right way to # select base character based on the equivalence class # as defined in the LC_CTYPE =# select * from test where value ~ 'mart[=i=]n'; I think it would be much easier if you did

[GENERAL] How does one impolement lists, or arrays, pin pl/pgsql ?

2007-06-29 Thread Gauthier, Dave
How does one implement a simple, general purpose, assignable array (or list) in pl/pgsql? From what I've found/read, it appears that you can declare static, read-only arrays. I'm guessing (and please correct if I'm wrong), PG does not support modifyable arrays. Rather, one might consider

Re: [GENERAL] Interval overflow?

2007-06-29 Thread Jeff Davis
On Fri, 2007-06-29 at 17:31 -0400, Tom Lane wrote: It looks like his case is overflowing the int8 microseconds field of the interval. On my machine, the seconds field is double so it does not overflow, but interval_out tries to convert the computed hours value to int32, and *that* overflows.

[GENERAL] what's wrong with this conf file?

2007-06-29 Thread Sergei Shelukhin
The server is dual Xeon with 4Gb RAM and 10k RPM RAID 1. There is no workload, we are running test conversion hence autovacuum off. I tried with on too, to no avail. Pg version is now 8.2. Here's my pg sql config file, unabridged. hba_file = '/etc/postgresql/8.2/main/pg_hba.conf' #

Re: [GENERAL] varchar(n) VS text

2007-06-29 Thread Kev
On Jun 26, 12:16 am, [EMAIL PROTECTED] (Tom Lane) wrote: Pierre Thibaudeau [EMAIL PROTECTED] writes: I am puzzling over this issue: 1) Is there ever ANY reason to prefer varchar(n) to text as a column type? In words of one syllable: no. If you have any input from untrusted sources (like

Re: [GENERAL] a JOIN on same table, but 'slided over'

2007-06-29 Thread Gurjeet Singh
It _is_ the optimised version as you can see from the explain plans posted in the other mail, the planner shows that the cost is drastically less than the 'distinct on' version. For smaller data-sets 'distinct-on' version might seem faster, but for reasonably larger datasets, it's

[GENERAL] [pgsql] Simple backup utility like mysqldump?

2007-06-29 Thread Bjorn Boulder
Hello People, I'm running PostgreSQL 8.1.1 on my freebsd box. I'm curious if PostgreSQL has a utility for backing up small databases like mysqldump or Oracle's export utility. -b ---(end of broadcast)--- TIP 3: Have you checked our extensive

Re: [GENERAL] [pgsql] Simple backup utility like mysqldump?

2007-06-29 Thread Oisin Glynn
Bjorn Boulder wrote: Hello People, I'm running PostgreSQL 8.1.1 on my freebsd box. I'm curious if PostgreSQL has a utility for backing up small databases like mysqldump or Oracle's export utility. -b ---(end of broadcast)--- TIP 3: Have you

[GENERAL] greatest/least semantics different between oracle and postgres

2007-06-29 Thread Bruno Wolff III
The following is just FYI. I was recently doing some stuff with greatest() on oracle (9.2.0.8.0) and noticed that it returned null if ANY of the arguments were null. Out of curiosity I checked postgres' definition of that function and found that it returns null only if ALL of the arguments are

Re: [GENERAL] varchar(n) VS text

2007-06-29 Thread Tom Lane
Kev [EMAIL PROTECTED] writes: On Jun 26, 12:16 am, [EMAIL PROTECTED] (Tom Lane) wrote: Pierre Thibaudeau [EMAIL PROTECTED] writes: I am puzzling over this issue: 1) Is there ever ANY reason to prefer varchar(n) to text as a column type? In words of one syllable: no. If you have any

Re: [GENERAL] Looking for help regarding getting the latest inserted sequence value.

2007-06-29 Thread Jan de Visser
On Thursday 28 June 2007 01:31:33 Mavinakuli, Prasanna (STSD) wrote: .And getting the max(id) from the table. Instead of that, use select currval('sequence'). currval will Return the value most recently obtained by nextval for this sequence in the current session. (An error is reported if

Re: [GENERAL] greatest/least semantics different between oracle and postgres

2007-06-29 Thread Andrej Ricnik-Bay
On 6/30/07, Bruno Wolff III [EMAIL PROTECTED] wrote: The following is just FYI. I was recently doing some stuff with greatest() on oracle (9.2.0.8.0) and noticed that it returned null if ANY of the arguments were null. Out of curiosity I checked postgres' definition of that function and found

Re: [GENERAL] greatest/least semantics different between oracle and postgres

2007-06-29 Thread Tom Lane
Andrej Ricnik-Bay [EMAIL PROTECTED] writes: On 6/30/07, Bruno Wolff III [EMAIL PROTECTED] wrote: I was recently doing some stuff with greatest() on oracle (9.2.0.8.0) and noticed that it returned null if ANY of the arguments were null. Out of curiosity I checked postgres' definition of that

Re: [GENERAL] greatest/least semantics different between oracle and postgres

2007-06-29 Thread Andrej Ricnik-Bay
On 6/30/07, Tom Lane [EMAIL PROTECTED] wrote: Hmm ... I fear Oracle's behavior is more correct, because if any argument is null (ie, unknown), then who can say what the greatest or least value is? It's unknown (ie, null). But I suspect our behavior is more useful. Comments? But in min/max

Re: [GENERAL] greatest/least semantics different between oracle and postgres

2007-06-29 Thread Bruno Wolff III
On Sat, Jun 30, 2007 at 00:15:42 -0400, Tom Lane [EMAIL PROTECTED] wrote: Andrej Ricnik-Bay [EMAIL PROTECTED] writes: On 6/30/07, Bruno Wolff III [EMAIL PROTECTED] wrote: I was recently doing some stuff with greatest() on oracle (9.2.0.8.0) and noticed that it returned null if ANY of the

[GENERAL] Sun Cluster and PGSQL

2007-06-29 Thread Aly Dharshi
Hello Folks, I hope that you are well, was just reading this article: http://www.sun.com/featured-articles/2007-0627/feature/index.jsp?intcmp=hp2007jun27_cluster_read Thought that it maybe of interest to you. Any thoughts ? Cheers, Aly. -- Aly Dharshi [EMAIL

Re: [GENERAL] greatest/least semantics different between oracle and postgres

2007-06-29 Thread Ben
On Jun 29, 2007, at 9:15 PM, Tom Lane wrote: Hmm ... I fear Oracle's behavior is more correct, because if any argument is null (ie, unknown), then who can say what the greatest or least value is? It's unknown (ie, null). But I suspect our behavior is more useful. Comments? I agree with

Re: [GENERAL] greatest/least semantics different between oracle and postgres

2007-06-29 Thread paul rivers
I believe the spec says nulls are ignored for min/max. Postgres is as far as I know behaving according to spec. But I question the original poster's report of Oracle's behavior. I don't have 9.2.0.8 to test, but on 9.2.0.7: SQL select f1, case when f1 is not null then 'not null' else 'null'

Re: [GENERAL] greatest/least semantics different between oracle and postgres

2007-06-29 Thread Tom Lane
Ben [EMAIL PROTECTED] writes: On Jun 29, 2007, at 9:15 PM, Tom Lane wrote: Hmm ... I fear Oracle's behavior is more correct, because if any argument is null (ie, unknown), then who can say what the greatest or least value is? It's unknown (ie, null). But I suspect our behavior is more

Re: [GENERAL] greatest/least semantics different between oracle and postgres

2007-06-29 Thread Tom Lane
paul rivers [EMAIL PROTECTED] writes: But I question the original poster's report of Oracle's behavior. I don't have 9.2.0.8 to test, but on 9.2.0.7: Er ... your example doesn't actually seem to involve greatest() or least()? regards, tom lane

Re: [GENERAL] greatest/least semantics different between oracle and postgres

2007-06-29 Thread paul rivers
Er ... your example doesn't actually seem to involve greatest() or least()? So sorry, it's been a long day, I misread. Yes, greatest/least definitely does work on Oracle as the OP said. Apologies again. ---(end of broadcast)--- TIP 4: