Re: [GENERAL] Problems inserting data into a table with a sequence

2007-10-15 Thread Greg Smith
On Mon, 15 Oct 2007, RNG wrote: Trying to insert data into this table using the following SQL INSERT INTO pn_categories_category (cat_id,cat_parent_id,cat_name,cat_display_name,cat_display_desc,cat_cr_date,cat_cr_uid,cat_lu_date,cat_lu_uid)VALUES (DEFAULT,'2','FAQ','a:1:{s:3:\"eng\";s:3:\"FAQ\";

Re: [GENERAL] reporting tools

2007-10-15 Thread Ow Mun Heng
On Mon, 2007-10-15 at 23:59 -0400, Robert James wrote: > Can you clarify the need / value added for reporting tool, over just > running queries and packaging the output in HTML (with a little CSS > for styling, you can get near PDF quality). This can be done in SQL > and a tad of PHP (or Ruby). >

Re: [GENERAL] reporting tools

2007-10-15 Thread Robert James
Can you clarify the need / value added for reporting tool, over just running queries and packaging the output in HTML (with a little CSS for styling, you can get near PDF quality). This can be done in SQL and a tad of PHP (or Ruby). On 10/15/07, Geoffrey <[EMAIL PROTECTED]> wrote: > > Ned Lilly w

Re: [GENERAL] can I define own variables?

2007-10-15 Thread Tom Lane
Guy Rouillier <[EMAIL PROTECTED]> writes: > I set that up, and using the SHOW command returns the set value. I > searched the archives and I couldn't identify a way to retrieve these > values in a trigger function. http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADMIN-S

Re: [GENERAL] can I define own variables?

2007-10-15 Thread Guy Rouillier
Tom Lane wrote: Guy Rouillier <[EMAIL PROTECTED]> writes: Tom Lane wrote: Another possibility, if you only need to store and retrieve values and not do anything especially interesting with them, is to abuse the "custom GUC variable" facility. I've had several occasions when a user-defined var

Re: [GENERAL] Convert bytea to Float8

2007-10-15 Thread Merlin Moncure
On 10/15/07, Lee Keel <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: Scott Marlowe [mailto:[EMAIL PROTECTED] > > Sent: Monday, October 15, 2007 3:54 PM > > To: Lee Keel > > Cc: pgsql-general@postgresql.org > > Subject: Re: [GENERAL] Convert bytea to Float8 > > > > Does somethin

Re: [GENERAL] Problems inserting data into a table with a sequence

2007-10-15 Thread Tom Lane
RNG <[EMAIL PROTECTED]> writes: > Trying to insert data into this table using the following SQL > ... > gives us the following error: > ERROR: duplicate key violates unique constraint > "pn_categories_category_pkey" Usually the reason for this is that you inserted some rows with manually assign

[GENERAL] Problems inserting data into a table with a sequence

2007-10-15 Thread RNG
Hi, we have a table whose definition looks like this (using postgres 8.2.5 on Linux): CREATE TABLE pn_categories_category ( cat_id integer NOT NULL, cat_parent_id integer DEFAULT 1 NOT NULL, cat_is_locked smallint DEFAULT 0 NOT NULL, cat_is_leaf smallint DEFAULT 0 NOT NULL, ca

Re: [GENERAL] Convert bytea to Float8

2007-10-15 Thread Lee Keel
> -Original Message- > From: Merlin Moncure [mailto:[EMAIL PROTECTED] > Sent: Monday, October 15, 2007 3:26 PM > To: Lee Keel > Cc: pgsql-general@postgresql.org > Subject: Re: [GENERAL] Convert bytea to Float8 > > On 10/15/07, Lee Keel <[EMAIL PROTECTED]> wrote: > > I am sorry to push this

Re: [GENERAL] Convert bytea to Float8

2007-10-15 Thread Lee Keel
> -Original Message- > From: Scott Marlowe [mailto:[EMAIL PROTECTED] > Sent: Monday, October 15, 2007 3:54 PM > To: Lee Keel > Cc: pgsql-general@postgresql.org > Subject: Re: [GENERAL] Convert bytea to Float8 > > Does something like: > > select encode('12346758'::bytea,'escape')::float >

Re: [GENERAL] Convert bytea to Float8

2007-10-15 Thread Sam Mason
On Mon, Oct 15, 2007 at 03:16:40PM -0500, Lee Keel wrote: > I am sorry to push this issue, but I have clients waiting on a solution for > this. So, does the lack of response mean that I am going to have to find > another approach? Or can this conversion be done in ppgsql\perl? This question prob

Re: [GENERAL] Convert bytea to Float8

2007-10-15 Thread Scott Marlowe
On 10/15/07, Lee Keel <[EMAIL PROTECTED]> wrote: > > > > > I am sorry to push this issue, but I have clients waiting on a solution for > this. So, does the lack of response mean that I am going to have to find > another approach? Or can this conversion be done in ppgsql\perl? Does something like

Re: [GENERAL] Convert bytea to Float8

2007-10-15 Thread Merlin Moncure
On 10/15/07, Lee Keel <[EMAIL PROTECTED]> wrote: > I am sorry to push this issue, but I have clients waiting on a solution for > this. So, does the lack of response mean that I am going to have to find > another approach? Or can this conversion be done in ppgsql\perl? this is trivially done in a

Re: [GENERAL] Convert bytea to Float8

2007-10-15 Thread Lee Keel
I am sorry to push this issue, but I have clients waiting on a solution for this. So, does the lack of response mean that I am going to have to find another approach? Or can this conversion be done in ppgsql\perl? Thanks in advance, Lee Keel _ From: [EMAIL PROTECTED] [mailto:[EM

Re: [GENERAL] Will UPDATE lock if FROM refers to target table?

2007-10-15 Thread Carlo Stonebanks
You cannot block yourself with a lock, if that's what you mean. The locks your session takes out will only block other sessions. Well, that's the GOOD news! The bad news is - I'm not sure whether there's somethign wrong with the logic of this query. The sub-query inside the FROM is correct, is

Re: [GENERAL] Restore v. Running COPY/INDEX seperatly

2007-10-15 Thread Benjamin Arai
In what order should I : - COPY data - Create indexes - Create Trigger - Vaccum ? Currently I am: 1. Create table 2 . Create trigger for updates 3. Create indexes including gin 4. Vaccum Benjamin On Aug 27, 2007, at 7:59 AM, Tom Lane wrote: Benjamin Arai <[EMAIL PROTECTED]> writes: Why is

Re: [GENERAL] 8.2.3: Server crashes on Windows using Eclipse/Junit

2007-10-15 Thread Kris Jurka
On Mon, 15 Oct 2007, Laurent Duperval wrote: I have a large amount of tests I run in Eclipse to test my application. Many of them create and delete a lot of information in PG and at some point, PG will crash and restart. I get en error in the logs that state: Server process exited with exit

[GENERAL] 8.2.3: Server crashes on Windows using Eclipse/Junit

2007-10-15 Thread Laurent Duperval
Hi, I have a large amount of tests I run in Eclipse to test my application. Many of them create and delete a lot of information in PG and at some point, PG will crash and restart. I get en error in the logs that state: Server process exited with exit code -1073741502 . . . Terminating connect

Re: [GENERAL] Calculation of per Capita on-the-fly - problems with SQL syntax

2007-10-15 Thread Michael Glaesemann
On Oct 15, 2007, at 10:50 , brian wrote: Adjust your data so that table agri_area has a row for each year? I can imagine that some of his raw data is a multi-year aggregate, so it may be difficult for him to do this. Otherwise, i think you'd need to parse your year column by expanding an

Re: [GENERAL] Calculation of per Capita on-the-fly - problems with SQL syntax

2007-10-15 Thread Sam Mason
On Mon, Oct 15, 2007 at 02:08:24PM +0200, Stefan Schwarzer wrote: > Just one thing: As my year columns can have as well values like "1970-75", > they are not integers, but text fields. Thus, the "IN" parameter in the > "WHERE" clause doesn't work. Do you have any other idea how ti could work? I'

Re: [GENERAL] atomic commit;begin for long running transactions , in combination with savepoint.

2007-10-15 Thread Trevor Talbot
On 10/15/07, Syan Tan <[EMAIL PROTECTED]> wrote: > >Also keep in mind that MVCC is not the only way to implement > >transactions; pure locking is more common in other databases. In the > >locking model, most transactions prevent others from writing until > >after they are finished. Rows simply c

Re: [GENERAL] atomic commit;begin for long running transactions , in combination with savepoint.

2007-10-15 Thread Trevor Talbot
On 10/15/07, Syan Tan <[EMAIL PROTECTED]> wrote: > thanks. I'll try it out, but sounds true enough; so there is no > isolation level where transaction state keeps track of all the read versions > of any item read so far by the transaction ? Right. That would be a whole different set of semantics.

[GENERAL] 8.2.5 -> 8.3 beta tsearch2 help

2007-10-15 Thread [EMAIL PROTECTED]
i tried to restore a dump from 8.2.5 in which i had used tsearch2 and contains lot of tsearch2 index. when i tried to restore it to 8.3beta it complained about 'unknow command \r\n' . i know it is from tsearch2. doesnt 8.3 have tsearch2 enabled by default? with 8.2xx i used to create a database and

Re: [GENERAL] Calculation of per Capita on-the-fly - problems with SQL syntax

2007-10-15 Thread brian
Stefan Schwarzer wrote: This should give you the same data out in a different format. Note that most of the NULL values will be excluded from this result. SELECT cname, year, d.value/pt.value FROM public_multiple_tables.agri_area AS d INNER JOIN public_multiple_tables.pop_total AS pt O

Re: [GENERAL] Importing MySQL dump into PostgreSQL 8.2

2007-10-15 Thread Alan Hodgson
On Friday 12 October 2007, wido <[EMAIL PROTECTED]> wrote: > > hi! but what happens when somebody sent you a dump file and you can't > convert the tables? all i have is a 116MB sql file, and i won't > convert it by hand :P Restore it into MySQL and then extract it in whatever form you like. Free

Re: Re : [GENERAL] Very asynchrnous replication system

2007-10-15 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > Bucardo is an interesting project (they've just released > a new version) but id does not look like they are able to > perform delayed (or very asynchronous) replication: from > the information I could gathered Bucardo replicates between >

Re: [GENERAL] TSearch chain dictionaries

2007-10-15 Thread Oleg Bartunov
On Mon, 15 Oct 2007, Hannes Dorbath wrote: I'm sure that is covered somewhere, but I failed to locate it. Is it not possible to chain dicts? Feed output from iSpell to a stemmer for example. no. As a workaround you can create your own dictionary ispell_stemmer_chain(), which does what you wa

Re: [GENERAL] atomic commit;begin for long running transactions , in combination with savepoint.

2007-10-15 Thread Syan Tan
On Mon Oct 15 5:28 , "Trevor Talbot" sent: >The only difference is in the data you _can_ read. For the >SERIALIZABLE isolation level, that data was decided at the beginning >of the transaction. A row that was updated by another transaction >will make the version that you can see effectively

[GENERAL] TSearch chain dictionaries

2007-10-15 Thread Hannes Dorbath
I'm sure that is covered somewhere, but I failed to locate it. Is it not possible to chain dicts? Feed output from iSpell to a stemmer for example. Thanks. -- Regards, Hannes Dorbath ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [GENERAL] Guideline on use of temporary tables

2007-10-15 Thread Merlin Moncure
On 10/12/07, Jimmy Choi <[EMAIL PROTECTED]> wrote: > I'm looking for general guideline on the use of temporary tables. > > I would like to use temporary table as a caching mechanism to speed up > queries within the same session. Specifically, a temporary table is > created to store a subset of data

Re: [GENERAL] reporting tools

2007-10-15 Thread Geoffrey
Ned Lilly wrote: On 10/14/2007 6:41 PM Geoffrey wrote: Bill Moran wrote: Geoffrey <[EMAIL PROTECTED]> wrote: Andrus wrote: I guess I should have noted that we will need to run this on Linux clients. Geoffrey, You can run FYIReporting engine in Linux using MONO ( www.go-mono.com ) Thanks,

Re: [GENERAL] atomic commit;begin for long running transactions , in combination with savepoint.

2007-10-15 Thread Syan Tan
thanks. I'll try it out, but sounds true enough; so there is no isolation level where transaction state keeps track of all the read versions of any item read so far by the transaction ? The main question is whether there's a way of avoiding implementing either those patterns of offline optimistic

[GENERAL] Convert bytea to Float8

2007-10-15 Thread Lee Keel
Can someone please answer what I hope to be an easy question? I am trying to convert 8 bytes of a bytea into a float8. In C# this code looks like: xCoord = System.BitConverter.ToDouble(arrByte, cnt) ; But in my plpgsql function, the following gives me an error: xCoord := substring(arrByte from

Re: [GENERAL] Guideline on use of temporary tables

2007-10-15 Thread Pavel Stehule
2007/10/15, Gauthier, Dave <[EMAIL PROTECTED]>: > Question regarding temp tables > > If I (user=joe) attach and run something that uses a temp table, then I > (user=joe again) attach again in another session, will there be 2 > distinct temp tables? Or does one user get one temp table per DB? >

Re: [GENERAL] Guideline on use of temporary tables

2007-10-15 Thread Gauthier, Dave
Question regarding temp tables If I (user=joe) attach and run something that uses a temp table, then I (user=joe again) attach again in another session, will there be 2 distinct temp tables? Or does one user get one temp table per DB? -Original Message- From: [EMAIL PROTECTED] [mail

Re: [GENERAL] atomic commit;begin for long running transactions , in combination with savepoint.

2007-10-15 Thread Trevor Talbot
On 10/15/07, Syan Tan <[EMAIL PROTECTED]> wrote: > >In order to detect a change occurred, what you want is a SERIALIZABLE > >transaction: you want the update to fail if the row it matches is no > >longer the same version as your snapshot. However, in order to read > >the new value to decide if yo

Re: [GENERAL] replicating to a stopped server

2007-10-15 Thread Joao Miguel Ferreira
On Fri, 2007-10-12 at 14:09 -0500, Erik Jones wrote: > On Oct 12, 2007, at 1:59 PM, Richard Huxton wrote: > > > Joao Miguel Ferrei > Are you restricted to keep that second server in that special run- > level? If not, I'd consider using pg_standby with WAL archiving to > keep your failover serv

Re: [GENERAL] Calculation of per Capita on-the-fly - problems with SQL syntax

2007-10-15 Thread Stefan Schwarzer
This should give you the same data out in a different format. Note that most of the NULL values will be excluded from this result. SELECT cname, year, d.value/pt.value FROM public_multiple_tables.agri_area AS d INNER JOIN public_multiple_tables.pop_total AS pt ON pt.id_country = d.id_c

Re: [GENERAL] pg_dump - schema diff compatibility

2007-10-15 Thread Filip RembiaƂkowski
Just an idea, but I would try to: - pg_dump both schemas in 'custom' format - extract TOC from each one - use the lists as a basis for compare (i guess that's what pgdiff does, maybe it just needs minor patch to extend its functionality ) 2007/10/12, Tomi N/A <[EMAIL PROTECTED]>: > Looking at

Re: [GENERAL] Guideline on use of temporary tables

2007-10-15 Thread Richard Huxton
Jimmy Choi wrote: I would like to use temporary table as a caching mechanism to speed up queries within the same session. Is this what temporary table is designed for? Are there caveats that I should be aware of? Can you think of other better alternatives? It's a very common usage of tempora

Re : [GENERAL] pg_dump - schema diff compatibility

2007-10-15 Thread Laurent ROCHE
Hi, I have complained before on this list that the latest pg_dump version will not have SERIAL declaration in the generated script but the equivalent SEQUENCE code (because I wanted to read the script and compare-diff it). I was replied that the aim of pg_dump is to produce a script to be able

Re: [GENERAL] CHAR SETS

2007-10-15 Thread Gregory Stark
"Albe Laurenz" <[EMAIL PROTECTED]> writes: > Cesar Alvarez wrote: >> I got a question, what are the differences of SQL_ASCII and UTF8, witch >> one should i use?? > SQL_ASCII is ASCII without encoding checks, UTF8 is UTF-8. > I think that you should use UTF8. Pros: UTF8 will let you handle other

Re: [GENERAL] Using case expressions in update set clause

2007-10-15 Thread Gregory Stark
"Chris Velevitch" <[EMAIL PROTECTED]> writes: > I just want to clarify that the following will always behave the way I > think it's supposed to behave:- > > update tableA > set date_field = case when date_field is null then some_date > els

Re : [GENERAL] Very asynchrnous replication system

2007-10-15 Thread Laurent ROCHE
Hi, Bucardo is an interesting project (they've just released a new version) but id does not look like they are able to perform delayed (or very asynchronous) replication: from the information I could gathered Bucardo replicates between databases always connected to each other. When I want to re

Re: [GENERAL] CHAR SETS

2007-10-15 Thread Albe Laurenz
Cesar Alvarez wrote: > I got a question, what are the differences of SQL_ASCII and UTF8, witch > one should i use?? SQL_ASCII is ASCII without encoding checks, UTF8 is UTF-8. I think that you should use UTF8. Yours, Laurenz Albe ---(end of broadcast)--

Re: [GENERAL] atomic commit;begin for long running transactions , in combination with savepoint.

2007-10-15 Thread Syan Tan
On Sun Oct 14 7:41 , "Trevor Talbot" sent: >On 10/14/07, Syan Tan wrote: >> I meant commit and continue current transaction. The transaction is opened >> on the user application caching composite data from many tables regarding >> a root object. Because almost all applications cache data, the

Re: [GENERAL] Will UPDATE lock if FROM refers to target table?

2007-10-15 Thread Albe Laurenz
Carlo Stonebanks wrote: > If I do an update using the FROM clause, and that clause has a sub-query > that refers to the table I am updating, will I be waiting for ever for a > table to lock to release? You cannot block yourself with a lock, if that's what you mean. The locks your session takes ou

Re: [GENERAL] RES: 8.2.4 selects make applications wait indefinitely

2007-10-15 Thread Tomasz Ostrowski
On Thu, 11 Oct 2007, Carlos H. Reimer wrote: > the problem happens with many machines where our Visual Basic > applications is running. After debuging the application we discovered that > the problem was always with "select *" statements. I'd try locally: $ psql -c 'select * from table where pk=