[GENERAL] cast type bytea to double precision

2012-02-16 Thread Amila Jayasooriya
HI All, I have a database column which type is bytea. It contains floats converted as byte array (4 bytes per one float) and encoding is Escape. I would be able to get corresponding bytea string using substring function. My question is how can I convert bytea string to float inside a SQL function

Re: [GENERAL] running multiple versions

2012-02-16 Thread John R Pierce
On 02/16/12 3:10 PM, John R Pierce wrote: so, if I was to install 8.4.somethignelse into a different directory, I'd need to create a seperate service for it, like... sc create postgres-8.4.5 binPath="D:/postgres/8.4.5/bin/pg_ctl.exe runservice -N postgresql-8.4.5 -D D:/postgres/8.4.5/data

[GENERAL] Set returning functions in select column list

2012-02-16 Thread Jack Christensen
Can someone explain how set returning functions in a select clause work? It seems that it is doing some sort of implicit cross join. deliverance_development=# select id, generate_series(1, 3) from users; id | generate_series +- 0 | 1 0 | 2 0

Re: [GENERAL] running multiple versions

2012-02-16 Thread Brent Wood
Run them in different locations with different addresses (5432 & 5433 for example) see this thread:http://archives.postgresql.org/pgsql-admin/2008-02/msg00084.php Brent Wood GIS/DBA consultant NIWA +64 (4) 4 386-0300 From: pgsql-general-ow...@postgresql.

[GENERAL] Functions that return a set in select column list

2012-02-16 Thread Jack Christensen
* Apologies if anyone receives this multiple times. I previously sent it with a subject that started with "Set" and it triggered some sort of admin filter. Can someone explain how set returning functions in a select clause work? It seems that it is doing some sort of implicit cross join. deli

[GENERAL] Set returning functions in select column list

2012-02-16 Thread Jack Christensen
* Apologies if anyone receives this twice. I previously sent it from another address and it did not appear to go through. Can someone explain how set returning functions in a select clause work? It seems that it is doing some sort of implicit cross join. deliverance_development=# select id, ge

Re: [GENERAL] MD5 salt in pg_authid password hashes

2012-02-16 Thread Stefan Weiss
On 2012-02-16 04:18, Adrian Klaver wrote: > When you alter the role name you are told the password has been cleared. It > would be fairly easy to wrap the rename and the setting of the password in a > transaction. But this shouldn't be necessary. I don't get why the salt has to be linked with th

Re: [GENERAL] Create duplicate of existing operator

2012-02-16 Thread Tom Lane
Andy Chambers writes: > Is it possible to use CREATE OPERATOR to make "&&" behave like "and"? Hmm ... AND is not really an operator, but a primitive expression construct. So I was about to say "no", but then it occurred to me you could do something like (untested): create function nonstandard_a

[GENERAL] Create duplicate of existing operator

2012-02-16 Thread Andy Chambers
Hi, Is it possible to use CREATE OPERATOR to make "&&" behave like "and"? In general, for the built-in operators, is it possible to see their "CREATE OPERATOR" statements? Cheers, Andy -- Andy Chambers *Software Engineer * *MCNA Dental Plans* 200 West Cypress Creek Road Suite 500 Fort Lauder

Re: Fwd: Re: [GENERAL] Dynamic update of a date field

2012-02-16 Thread Steve Crawford
On 02/16/2012 02:45 PM, John R Pierce wrote: On 02/16/12 2:34 PM, David Salisbury wrote: Would it not be advantageous to replicate information in the above form if you wanted to, say, get all records in the month of May, and therefore create an index on the month field? I would think that woul

Re: [GENERAL] running multiple versions

2012-02-16 Thread Adrian Klaver
On Thursday, February 16, 2012 3:03:45 pm Guillaume Lelarge wrote: > On Thu, 2012-02-16 at 15:00 -0800, Adrian Klaver wrote: > > On Thursday, February 16, 2012 2:17:33 pm Guillaume Lelarge wrote: > > > Hi, > > > > > > > If so can you run different minor versions or only different major > > > > ver

Re: [GENERAL] running multiple versions

2012-02-16 Thread John R Pierce
On 02/16/12 3:00 PM, Adrian Klaver wrote: This is a limitation of the Postgres Windows Installer? Compiling from source would allow running different minor versions. probably the windows service names is the sticking point. you'd need to create a custom service, which could be done with the '

Re: [GENERAL] How to dereference 2 dimensional array?

2012-02-16 Thread Merlin Moncure
On Thu, Feb 16, 2012 at 9:48 AM, ChoonSoo Park wrote: > I would like to construct hstore array from 2 dimensional array. > > > For example, > > > '{{f1, 1, f2, 123, f3, ABC, ...}, {f1, 2, f2, 345, f3, DEF, ...}}' > > > Should be converted to > > > 2 hstore values > > "f1"=>"1", "f2"=>"123", "f3"=>

Re: [GENERAL] running multiple versions

2012-02-16 Thread Guillaume Lelarge
On Thu, 2012-02-16 at 15:00 -0800, Adrian Klaver wrote: > On Thursday, February 16, 2012 2:17:33 pm Guillaume Lelarge wrote: > > Hi, > > > > > > If so can you run different minor versions or only different major > > > versions? > > > > Only major versions. > > This is a limitation of the Postgr

Re: [GENERAL] running multiple versions

2012-02-16 Thread Adrian Klaver
On Thursday, February 16, 2012 2:17:33 pm Guillaume Lelarge wrote: > Hi, > > > If so can you run different minor versions or only different major > > versions? > > Only major versions. This is a limitation of the Postgres Windows Installer? Compiling from source would allow running different m

Re: [GENERAL] How to dereference 2 dimensional array?

2012-02-16 Thread Bartosz Dmytrak
Hi, this could be start point for discussion: CREATE OR REPLACE FUNCTION public."arraysToHstore" (IN a TEXT[], OUT c hstore[]) RETURNS hstore[] AS $BODY$ DECLARE i INT; elements INT; dim INT; BEGIN elements := array_length(a,2); -- # of elements in each dimension dim := array_length(a,1); -- #

Re: Fwd: Re: [GENERAL] Dynamic update of a date field

2012-02-16 Thread John R Pierce
On 02/16/12 2:34 PM, David Salisbury wrote: Would it not be advantageous to replicate information in the above form if you wanted to, say, get all records in the month of May, and therefore create an index on the month field? I would think that would be more efficient than creating a functional

Fwd: Re: [GENERAL] Dynamic update of a date field

2012-02-16 Thread David Salisbury
On 2/16/12 7:27 AM, Andreas Kretschmer wrote: Musial, Jan (GIUB) wrote: smallint,month smallint,day smallint,time_stamp date); I would like to That's silly, use one (and only one) field, timestamp (or timestamptz) Don't use never ever multiple columns for the same information! Would it no

Re: [GENERAL] running multiple versions

2012-02-16 Thread Guillaume Lelarge
Hi, On Fri, 2012-02-17 at 00:11 +0200, Heine Ferreira wrote: > [...] > Is it possible to run more than one instance of Postgresql on Windows? Yes. > Can you run different versions simultaneously? Yes > If so can you run different minor versions or only different major versions? Only major ver

Re: [GENERAL] running multiple versions

2012-02-16 Thread John R Pierce
On 02/16/12 2:11 PM, Heine Ferreira wrote: Is it possible to run more than one instance of Postgresql on Windows? Can you run different versions simultaneously? If so can you run different minor versions or only different major versions? If possible how do you do this? install to different di

[GENERAL] running multiple versions

2012-02-16 Thread Heine Ferreira
Hi Is it possible to run more than one instance of Postgresql on Windows? Can you run different versions simultaneously? If so can you run different minor versions or only different major versions? If possible how do you do this? Thanks H.F.

Re: [GENERAL] Check if backup is in progress

2012-02-16 Thread Marti Raudsepp
On Thu, Feb 16, 2012 at 18:53, sodik wrote: > is there any way how to check that postgres 9.1 is currently in backup > mode? You can check the existence of the "backup_label" file in your data directory. If it's there, then a backup is in progress. If your monitoring system is on a diferent serv

[GENERAL] Re: [GENERAL] conexão no windows 7

2012-02-16 Thread Diego Schulz
2012/2/15 vossistemas > > Instalei o Postgresql 8.3 no windows 7 como servidor. Em uma estação com xp > estou tentando me conectar e ocorre a seguinte mensagem: FATAL: no > pg_hba.conf entry for host "192.168.1.51", user "Vilson", database > "postgres", SSL off . > > No servidor com windows 7 está

Re: [GENERAL] How to recover data from cluster

2012-02-16 Thread Adrian Klaver
On 02/16/2012 11:37 AM, Alan Hodgson wrote: On Thursday, February 16, 2012 09:18:34 PM Andrus wrote: It sounds like your new installation is not in fact using the old data directory, but a new empty one. To add, are you sure that pgAdmin is pointed at the right server? -- Adrian Kla

Re: [GENERAL] How to recover data from cluster

2012-02-16 Thread Alan Hodgson
On Thursday, February 16, 2012 09:18:34 PM Andrus wrote: > PostgreSql 8.4 in windows crashes. After that Windows disk repairing was > used to repair hard drive. After that Data/base directory from crashed > server contains lot of files, all files are readable. > > PostgreSql 8.4 was reinstalled in

Re: [GENERAL] How to recover data from cluster

2012-02-16 Thread Adrian Klaver
On 02/16/2012 11:18 AM, Andrus wrote: PostgreSql 8.4 in windows crashes. After that Windows disk repairing was used to repair hard drive. After that Data/base directory from crashed server contains lot of files, all files are readable. There is readable and there is not-corrupt :( PostgreSql

[GENERAL] How to recover data from cluster

2012-02-16 Thread Andrus
PostgreSql 8.4 in windows crashes. After that Windows disk repairing was used to repair hard drive. After that Data/base directory from crashed server contains lot of files, all files are readable. PostgreSql 8.4 was reinstalled in new server and data directory was set to directory from crashed

Re: [GENERAL] Unable to execute \copy from Client Application

2012-02-16 Thread John R Pierce
On 02/16/12 1:05 AM, sujayr06 wrote: Please find the usage of \copy and the corresponding API. strPgSqlQuerybuf<<"\\copy hnb_registration FROM '/root/Sujay/hnbfile.txt' USING DELIMITERS ','"; The \ commands are all metacommands for the PSQL utility, none

[GENERAL] Check if backup is in progress

2012-02-16 Thread sodik
Hi, is there any way how to check that postgres 9.1 is currently in backup mode? Imagine the situation that my DB is running and the backup is remotely started by # select pg_start_backup('backup', true); However the remote site crashed and can't stop the backup. Is there any way how to check i

Re: [GENERAL] Dynamic update of a date field

2012-02-16 Thread Musial, Jan (GIUB)
Dear Adrian & Andreas, Thank you very much for this pieces of advice. I end up with creating a insert-triger function, which does the trick. As far as the redundant time information within my database is concerned this is an data import issue. Simply it is easier for me to import year,month day

[GENERAL] How to dereference 2 dimensional array?

2012-02-16 Thread ChoonSoo Park
I would like to construct hstore array from 2 dimensional array. For example, '{{f1, 1, f2, 123, f3, ABC, ...}, {f1, 2, f2, 345, f3, DEF, ...}}' Should be converted to 2 hstore values "f1"=>"1", "f2"=>"123", "f3"=>"ABC", ... "f2"=>"2", "f2"=>"345", "f3"=>"DEF", ... create or replace fun

Re: [GENERAL] Drop big index

2012-02-16 Thread Vojtěch Rylko
Dne 16.2.2012 9:53, Marti Raudsepp napsal(a): 2012/2/15 Vojtěch Rylko: this query performed so long and blocked table so I had to interrupt it. Is there any way how to drop large indexes in non-blocking or /faster/ way? Usually the problem is not with the size of the index -- but some other run

Re: [GENERAL] Dynamic update of a date field

2012-02-16 Thread Adrian Klaver
On Thursday, February 16, 2012 6:05:40 am Musial, Jan (GIUB) wrote: > Dear all, > > I have a question concerning default value/trigger function which supposed > to update/fill field called time_stamp whenever a row is inserted. Let say > that we have a table: CREATE TABLE dummy (year smallint,mont

Re: [GENERAL] [GENERA]: Postgresql-9.1.1 synchronous replication issue

2012-02-16 Thread Adrian Klaver
On Wednesday, February 15, 2012 10:21:02 pm Venkat Balaji wrote: > Andrian, > > Thanks a lot ! > > So in this case you are not waiting for confirmation of the commit being > > > flushed > > to disk on the standby. It that case you are bypassing the primary > > reason for > > sync replication. T

Re: [GENERAL] Dynamic update of a date field

2012-02-16 Thread Andreas Kretschmer
Musial, Jan (GIUB) wrote: > Dear all, > > I have a question concerning default value/trigger function which > supposed to update/fill field called time_stamp whenever a row is > inserted. Let say that we have a table: CREATE TABLE dummy (year you can use 'default now()' or an insert-trigger >

Re: [GENERAL] [postgis-users] ST_AsJpeg

2012-02-16 Thread Stefan Keller
2012/2/16 Sandro Santilli : > I don't think there's much to discuss. > I'm sure a patch to psql would be welcome. Sorry, I did not realize that the solution is straight forward :-> --Stefan -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscriptio

[GENERAL] Dynamic update of a date field

2012-02-16 Thread Musial, Jan (GIUB)
Dear all, I have a question concerning default value/trigger function which supposed to update/fill field called time_stamp whenever a row is inserted. Let say that we have a table: CREATE TABLE dummy (year smallint,month smallint,day smallint,time_stamp date); I would like to update "time_stamp

Re: [GENERAL] Drop big index

2012-02-16 Thread Andreas Kretschmer
Albe Laurenz wrote: > Vojtech Rylko wrote: > > I need to drop some b-tree indexes because they are not used anymore. > > Size of indexes vary between 700 MB and 7 GB. I tried common DROP > > INDEX... but this query performed so long and blocked table so I had to > > interrupt it. Is there any way

Re: [GENERAL] Dump functions alone

2012-02-16 Thread Jan Otto
> Any help in getting function argument names is appreciated. Thank you take a look at pg_catalog.pg_get_function_arguments(oid) regards, jan -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-gen

[GENERAL] Optimize sort before groupping

2012-02-16 Thread pasman pasmański
Hi. Sometimes order of rows readed from index allows to skip sort node. But sometimes planner don't deduce it. In example below order from index "NumerStacji_NumerKierunkowy_KodBłędu_LP" is preserved in merge join and can be used in groupping node, but planner don't see it. First query and explai

Re: [GENERAL] Unable to execute \copy from Client Application

2012-02-16 Thread Guillaume Lelarge
On Thu, 2012-02-16 at 01:05 -0800, sujayr06 wrote: > Hello, > >Please find the usage of \copy and the corresponding API. > >strPgSqlQuerybuf<<"\\copy hnb_registration FROM > '/root/Sujay/hnbfile.txt' USING DELIMITERS ','"; > >pPostGresQ

Re: [GENERAL] Unable to execute \copy from Client Application

2012-02-16 Thread sujayr06
Hello, Please find the usage of \copy and the corresponding API. strPgSqlQuerybuf<<"\\copy hnb_registration FROM '/root/Sujay/hnbfile.txt' USING DELIMITERS ','"; pPostGresQueryResult = PQexecParams(pPgConnection, strPgSqlQuerybuf.str().c_s

Re: [GENERAL] Unable to execute \copy from Client Application

2012-02-16 Thread sujayr06
Hello Guillaume, Please find the usage of \copy and the corresponding API. strPgSqlQuerybuf<<"'\'copy hnb_registration FROM '/root/Sujay/hnbfile.txt' USING DELIMITERS ','"; pPostGresQueryResult = PQexecParams(pPgConnection, strPgSqlQuerybu

Re: [GENERAL] Drop big index

2012-02-16 Thread Marti Raudsepp
2012/2/15 Vojtěch Rylko : > this query performed so long and blocked table so I had to interrupt it. Is > there any way how to drop large indexes in non-blocking or /faster/ way? Usually the problem is not with the size of the index -- but some other running transactions that hold a read lock on t

[GENERAL] RE: [GENERAL] conexão no windows 7

2012-02-16 Thread Albe Laurenz
vossistemas wrote: > Instalei o Postgresql 8.3 no windows 7 como servidor. Em uma estação com xp > estou tentando me conectar e ocorre a seguinte mensagem: FATAL: no > pg_hba.conf entry for host "192.168.1.51", user "Vilson", database > "postgres", SSL off . > > No servidor com windows 7 está conf

Re: [GENERAL] Drop big index

2012-02-16 Thread Albe Laurenz
Vojtech Rylko wrote: > I need to drop some b-tree indexes because they are not used anymore. > Size of indexes vary between 700 MB and 7 GB. I tried common DROP > INDEX... but this query performed so long and blocked table so I had to > interrupt it. Is there any way how to drop large indexes in no

Re: [GENERAL] Unable to execute \copy from Client Application

2012-02-16 Thread Guillaume Lelarge
On Thu, 2012-02-16 at 00:07 -0800, sujayr06 wrote: > Hello All, > >My application is a C++ APP. > >I'm executing \copy command from the CPP and its as follows > >strPgSqlQuerybuf<<"\\copy hnb_registration FROM > '/root/Sujay/hnbfile.txt' USING DELIMITERS ','";

[GENERAL] Unable to execute \copy from Client Application

2012-02-16 Thread sujayr06
Hello All, My application is a C++ APP. I'm executing \copy command from the CPP and its as follows strPgSqlQuerybuf<<"\\copy hnb_registration FROM '/root/Sujay/hnbfile.txt' USING DELIMITERS ','"; Second \ is to keep the compiler happy. When this comm