Re: [GENERAL] Triggering a function on table overwrite

2012-02-06 Thread Misa Simic
Hi Bob, I guess with overwrite the table you mean to fill some columns with your values in trigger... If that is the case, in docs is example: http://www.postgresql.org/docs/8.1/static/plpgsql-trigger.html Kind Regards, Misa Sent from my Windows Phone -- From: Bob

Re: [GENERAL] Triggering a function on table overwrite

2012-02-06 Thread Thomas Kellerer
Misa Simic, 06.02.2012 10:35: Hi Bob, I guess with overwrite the table you mean to fill some columns with your values in trigger... If that is the case, in docs is example: http://www.postgresql.org/docs/8.1/static/plpgsql-trigger.html Kind Regards, Please do not link to outdated

Re: [GENERAL] Triggering a function on table overwrite

2012-02-06 Thread Chris Angelico
On Mon, Feb 6, 2012 at 8:42 PM, Thomas Kellerer spam_ea...@gmx.net wrote: Misa Simic, 06.02.2012 10:35: Hi Bob, I guess with overwrite the table you mean to fill some columns with your values in trigger... If that is the case, in docs is example:

Re: [GENERAL] Triggering a function on table overwrite

2012-02-06 Thread Misa Simic
+1 I could undertsand the need to point to current version... but my goal was just to give someone a hint for his problem... I have answered from bed, from my mobile phone... so it was shortcut - few taps copy/paste, and google pointed me to the link... In case I needed to worry about is it for

Re: [GENERAL] Error while importing CSV file

2012-02-06 Thread Alban Hertroys
On 6 February 2012 07:37, Lockas w_war...@hotmail.com wrote: I've tried a lot of sizes but I still have messages in my log saying: *  ---  ERROR:  value too long for type character varying(200)  --- * Why is this? There are no other varchar(200) columns in my DB at all, no other table.

Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?

2012-02-06 Thread Jasen Betts
On 2012-01-25, hubert depesz lubaczewski dep...@depesz.com wrote: On Wed, Jan 25, 2012 at 02:07:40PM -0800, Adrian Klaver wrote: Finally dawned on me. When you use 'at time zone' on a timestamp with tz it strips the tz which then allows the value to be indexed because: -[ RECORD 5

Re: [GENERAL] Why this regexp matches?!

2012-02-06 Thread Jasen Betts
On 2012-02-04, hubert depesz lubaczewski dep...@depesz.com wrote: select 'depesz depeszx depesz' ~ E'^(.*)( \\1)+$'; what's worse: $ select regexp_replace( 'depesz depeszx depesz', E'^(.*)( \\1)+$', E'\\1' ); regexp_replace depesz (1 row) I know that Pg regexps are

Re: [GENERAL] Why extract( ... from timestamp ) is not immutable?

2012-02-06 Thread Jasen Betts
On 2012-01-25, Adrian Klaver adrian.kla...@gmail.com wrote: On Wednesday, January 25, 2012 7:48:34 am hubert depesz lubaczewski wrote: On Wed, Jan 25, 2012 at 07:44:14AM -0800, Adrian Klaver wrote: I thought that this is what I will achieve with extract(epoch from now() at time zone 'UTC')

Re: [GENERAL] Why this regexp matches?!

2012-02-06 Thread hubert depesz lubaczewski
On Mon, Feb 06, 2012 at 11:29:23AM +, Jasen Betts wrote: On 2012-02-04, hubert depesz lubaczewski dep...@depesz.com wrote: select 'depesz depeszx depesz' ~ E'^(.*)( \\1)+$'; what's worse: $ select regexp_replace( 'depesz depeszx depesz', E'^(.*)( \\1)+$', E'\\1' );

Re: [GENERAL] vacuumlo fails pgsql ver 8.3

2012-02-06 Thread Pat Heuvel
On 6/02/2012 4:39 AM, Tom Lane wrote: Pat Heuvelpheu...@tpg.com.au writes: [ vacuumlo fails ] When I added the -v option, there were many removing lo x messages before the above messages appeared. I have previously tried to reindex pg_largeobject, but that process failed as well. You need

Re: [GENERAL] Error while importing CSV file

2012-02-06 Thread Lockas
* ok then if I want to except that row from copying. how i can write it ?* -- View this message in context: http://postgresql.1045698.n5.nabble.com/Error-while-importing-CSV-file-tp5458103p5459976.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via

Re: [GENERAL] Error while importing CSV file

2012-02-06 Thread David Johnston
On Feb 6, 2012, at 7:26, Lockas w_war...@hotmail.com wrote: * ok then if I want to except that row from copying. how i can write it ?* Copy is all or nothing. Either fix the problem row(s) or remove them from the file manually. David J. -- Sent via pgsql-general mailing list

Re: [GENERAL] Error while importing CSV file

2012-02-06 Thread Alban Hertroys
On 6 February 2012 13:26, Lockas w_war...@hotmail.com wrote: * ok then if I want to except that row from copying. how i can write it ?* You can either remove the offending line(s) from the csv file or copy to a staging table that doesn't have those limitations on field lengths first. -- If

[GENERAL] Backup database remotely

2012-02-06 Thread Fanbin Meng
I installed the PostgreSql9.0 in windows 7 with one click installer. How can i backup another PostgreSql server database remotely via an internet connection . I trid add a connection to a server, but it did not work. Does anyone can help me or give suggestions? Thanks Fanbin

Re: [GENERAL] Puzzling full database lock

2012-02-06 Thread Merlin Moncure
On Fri, Feb 3, 2012 at 2:55 PM, Christopher Opena counterv...@gmail.com wrote: Merlin, thanks for the response. no problem. if you're open to architecture suggestions you might also want to consider going with HS/SR and getting those large olap queries off your main database. you'll have to

[GENERAL] How to create crosstab with 3 values in every crosstab column

2012-02-06 Thread Andrus
I'm looking for a way to generate cross tab with 3 columns for every store where number of stores in not hard coded. Every store info should contain 3 columns: turnover budget budget percent (=turnover/budget*100) Result should look like: Acc st1turnover st1budget st1percent ...

Re: [GENERAL] How to create crosstab with 3 values in every crosstab column

2012-02-06 Thread Misa Simic
Hm... I am not sure it is possible at all and with just 1 column for crosstab (instead of 3) to return table with undefined No of columns (to number of stores do not be hardcoded)... At least you must define your return type... Problem is known to me, and we have solved it on some way... which

[GENERAL] windows 2008 scheduled task problem

2012-02-06 Thread Ralph Dell
I am running postgresql 8.4.3/ postgis 1.5 on a windows server 2008 R2 I am unable to get the shp2pgsql command to run as scheduled tasks. There is no problem running any of the commands from the command line or a python script. Some sample commands are shp2pgsql -s 900913 -I -d

Re: [GENERAL] How to create crosstab with 3 values in every crosstab column

2012-02-06 Thread Andrus
Thank you. first calculate how much columns we should return...No of stores in in your Sales table (multiply 3 in your case)... (and based on that - build the grid in UI) then with knowing that - we select full table with simple 3 functions: CalcSales(coount, Store), getBudget(account, Store)

Re: [GENERAL] windows 2008 scheduled task problem

2012-02-06 Thread Susan Cassidy
See my reply below: From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Ralph Dell Sent: Monday, February 06, 2012 8:26 AM To: pgsql-general@postgresql.org Subject: [GENERAL] windows 2008 scheduled task problem I am running postgresql 8.4.3/ postgis

Re: [GENERAL] vacuumlo fails pgsql ver 8.3

2012-02-06 Thread Tom Lane
Pat Heuvel pheu...@tpg.com.au writes: On 6/02/2012 4:39 AM, Tom Lane wrote: What exactly happens when you try to reindex pg_largeobject? ERROR: could not create unique index pg_largeobject_loid_pn_index DETAIL: Table contains duplicated values. Could be worse. What you'll need to do is

Re: [GENERAL] windows 2008 scheduled task problem

2012-02-06 Thread Richard Sickler
Ralph, It may help to break this into a couple of parts Make a folder called c:\cronjobs in c:\cronjobs create a bat file that contains the commands you want executed. Maybe something like set logfile=shp2pgsql.log echo Running shp2pgsql %logfile% date /t %logfile% time /t %logfile%

Re: [GENERAL] Backup database remotely

2012-02-06 Thread Andreas Kretschmer
Fanbin Meng fanbin.m...@kiltechcontrols.com wrote: I installed the PostgreSql9.0 in windows 7 with one click installer. How can i backup another PostgreSql server database remotely via an internet connection . I trid add a connection to a server, but it did not work. Don't know waht you

Re: [GENERAL] How to create crosstab with 3 values in every crosstab column

2012-02-06 Thread Misa Simic
Hi, I think you dont understand me (or I do not understand you :) ) the point is - it is not possible to get unknown no of columns in 1 SQL query... i.e. Account, Store, Amount 100, St1, 1000.00 100, St2, 2000.00 to get: Acount,St1 , St2 100, 1000.00 2000.00 to get

Re: [GENERAL] How to create crosstab with 3 values in every crosstab column

2012-02-06 Thread Andrus
Thank you. the point is - it is not possible to get unknown no of columns in 1 SQL query... i.e. Account, Store, Amount 100, St1, 1000.00 100, St2, 2000.00 to get: Acount,St1 , St2 100, 1000.00 2000.00 to get that in your query... St1 and St2 - must be hardcoded... (is

Re: [GENERAL] How to create crosstab with 3 values in every crosstab column

2012-02-06 Thread Misa Simic
Hi, Well, I think you will need to write your own function(s) which will solve your particular case... There are two ways explaind in last mails... Dynamic SQL or direct export to file... Kind Regards, Misa 2012/2/6 Andrus kobrule...@hot.ee Thank you. the point is - it is not possible

[GENERAL] SSL mode detection

2012-02-06 Thread Bosco Rama
Hi folks, I'm using PG 8.4.10 on Ubuntu Server 10.04.3.LTS x86_64. Is there any way to query the SSL mode for client connections? E.g. select backend_id from some_table_or_view where ssl_mode = false; I have not been able to find it in pg_stat_activity or anywhere else in the catalog. Maybe

Re: [GENERAL] How to create crosstab with 3 values in every crosstab column

2012-02-06 Thread Marc Mamin
Hello, as you don't seems to need the returned column definition in Postgres, a solution may be to cast the result to text. e.g.: create or replace function get_record () returns setof text as $$ select (foo)::text from (values(1,'a a'),(3,'b b'))foo $$ language sql;

Re: [GENERAL] windows 2008 scheduled task problem

2012-02-06 Thread Ralph Dell
Ralph Dell, GISP GIS Dept. Catawba County, NC From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Richard Sickler Sent: Monday, February 06, 2012 12:04 PM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] windows 2008 scheduled task

Re: [GENERAL] windows 2008 scheduled task problem - Solved

2012-02-06 Thread Ralph Dell
I don't want to admit how many times I have revisited this but I have some preliminary tests working. My test server is XP and I just reconfirmed that there are no issues getting the scheduled task to run on that box pretty easily. On the windows server 2008 the following looks like it

[GENERAL] pg_upgrade: out of memory

2012-02-06 Thread deepak
Hi! While running pg_upgrade, on one instance, it ran out of memory during the final stages of upgrade (just before it starts to link old database files to new ones). We are using Postgres 9.1.1, and I see that there were some fixes to pg_upgrade in 9.1.2, though it doesn't mention anything

[GENERAL] problems connecting to php via pg_connect and PGCLUSTER

2012-02-06 Thread Dave Potts
I have two versions of postgres installed, 8.4 and 9.1 installed on the same machine To connect to my 9.1 database, I defined the envromental variable PGCLUSTER=9.1/main and use psql to connect via php pg_connect I have try saying define(PG_OPTIONS , --cluster=9.1/main); and using the

Re: [GENERAL] problems connecting to php via pg_connect and PGCLUSTER

2012-02-06 Thread Chris
On 07/02/12 10:03, Dave Potts wrote: I have two versions of postgres installed, 8.4 and 9.1 installed on the same machine To connect to my 9.1 database, I defined the envromental variable PGCLUSTER=9.1/main and use psql to connect via php pg_connect I have try saying define(PG_OPTIONS ,

Re: [GENERAL] \copy: unexpected response (4)

2012-02-06 Thread Charlie
I have encountered the symmetric error to this - PGRES_COPY_OUT. We are using a foreign data wrapper into a large (and unnamed) database system which generates a substantial pipeline of rows for copyout to bring back through libPQ to respond to the psql request. If the back end is blown away the

Re: [GENERAL] Don't Thread On Me (PostgreSQL related)

2012-02-06 Thread Rodrigo E . De León Plicet
On Jan 26, 4:52 pm, Rodrigo E. De León Plicet rdele...@gmail.com wrote: Quote: == This thread http://postgresql.1045698.n5.nabble.com/Multithread-Query-Planner-td5... was mentioned in a performance sub-group posting. Give

Re: [GENERAL] Don't Thread On Me (PostgreSQL related)

2012-02-06 Thread John R Pierce
On 02/03/12 5:53 PM, Rodrigo E. De León Plicet wrote: Author's followup: http://drcoddwasright.blogspot.com/2012/02/damn-you-damocles.html his links hardly seem related to his proclamations. -- john r pierceN 37, W 122 santa cruz ca

Re: [GENERAL] Error while importing CSV file

2012-02-06 Thread Lockas
OK .. my offending line number is 4533 How can i remove it while copying ? *COPY Table FROM 'insert .csv dir here' USING DELIMITERS ';' CSV HEADER* -- View this message in context: http://postgresql.1045698.n5.nabble.com/Error-while-importing-CSV-file-tp5458103p5462255.html Sent from the

Re: [GENERAL] Don't Thread On Me (PostgreSQL related)

2012-02-06 Thread Chris Travers
My reply is at: http://ledgersmbdev.blogspot.com/2012/02/robert-young-is-wrong-about-threads-and.html On Mon, Feb 6, 2012 at 9:05 PM, John R Pierce pie...@hogranch.com wrote: On 02/03/12 5:53 PM, Rodrigo E. De León Plicet wrote: Author's followup:

Re: [GENERAL] problems connecting to php via pg_connect and PGCLUSTER

2012-02-06 Thread Dave Potts
Hi Chris Thanks for the suggestion, I tried a making the changes are you suggest, I still getting an error from Postgres ie define(PG_OPTIONS , --cluster=9.1/main); define(PG_DB , tripe); define(PG_HOST, localhost); define(PG_USER, dp42); define(PG_PORT, 5432); define(TABLE,

[GENERAL] default database selector

2012-02-06 Thread Dave Potts
I am running Ubuntu 11.04, I have Postgres 8.4 and 9.1 installed. My default when I say psql it connects to postgres 8.4 ie I set export PGCLUSTER=9.1/main it connects to 9.1 Q. How can I connect to 9.1 by default without having to set PGCLUSTER? I looked in /etc/postgresql-common, there