Re: [GENERAL] Dynamically update NEW columns in plpgsql trigger

2010-09-08 Thread Pavel Stehule
Hello plpgsql isn't good tool for this. use a plperl or plpython instead. your solution is extremly slow. Regards Pavel Stehule 2010/9/9 Nick : > I need to dynamically update NEW columns. Ive been inserting the NEW > values into a temp table, updating them, then passing the temp table > values

[GENERAL] Dynamically update NEW columns in plpgsql trigger

2010-09-08 Thread Nick
I need to dynamically update NEW columns. Ive been inserting the NEW values into a temp table, updating them, then passing the temp table values back to NEW (is there a better way?). Ive had success with this method unless there is a null value... EXECUTE 'CREATE TEMP TABLE new AS SELECT $1.*' USI

Re: [GENERAL] line CASE statemelnt in query a la Oracle

2010-09-08 Thread John R Pierce
On 09/08/10 10:05 PM, Dennis Gearon wrote: I would like to have a query replace a NULL in a field with a truncated value from one field based on a size passed in? Basically, I'd like to be able to generate a 'short title' for a record based on either the user's input for a short title, or a

[GENERAL] line CASE statemelnt in query a la Oracle

2010-09-08 Thread Dennis Gearon
I would like to have a query replace a NULL in a field with a truncated value from one field based on a size passed in? Basically, I'd like to be able to generate a 'short title' for a record based on either the user's input for a short title, or a turncated 'normal title' at query time. Wo

Re: [GENERAL] postgresql cluster on SAN

2010-09-08 Thread Craig Ringer
On 9/09/2010 11:02 AM, Lazaro Ruben Garcia Martinez wrote: Thank you very much for your answer, In the cluster that i said before I need only failover. In the documentation of postgresql I read about the Shared Disk Failover, this tecnique avoids synchronization overhead by having only one copy

Re: [GENERAL] postgresql cluster on SAN

2010-09-08 Thread John R Pierce
On 09/08/10 8:02 PM, Lazaro Ruben Garcia Martinez wrote: Thank you very much for your answer, In the cluster that i said before I need only failover. In the documentation of postgresql I read about the Shared Disk Failover, this tecnique avoids synchronization overhead by having only one copy

Re: [GENERAL] postgresql cluster on SAN

2010-09-08 Thread Scott Marlowe
On Wed, Sep 8, 2010 at 9:02 PM, Lazaro Ruben Garcia Martinez wrote: > Thank you very much for your answer, In the cluster that i said before I > need only failover. > In the documentation of postgresql I read about the Shared Disk Failover, > this tecnique avoids synchronization overhead by having

Re: [GENERAL] postgresql cluster on SAN

2010-09-08 Thread Lazaro Ruben Garcia Martinez
Thank you very much for your answer, In the cluster that i said before I need only failover. In the documentation of postgresql I read about the Shared Disk Failover, this tecnique avoids synchronization overhead by having only one copy of the database. It uses a single disk array that is share

Re: [GENERAL] postgresql cluster on SAN

2010-09-08 Thread Craig Ringer
On 9/09/2010 10:27 AM, Lazaro Ruben Garcia Martinez wrote: Hello everyone: I am a student of the University of Informatics Science in Cuba. I want create a postgresql cluster and I have two servers but I have a doubt. Is possible to create a cluster of postgresql server by sharing the database f

[GENERAL] postgresql cluster on SAN

2010-09-08 Thread Lazaro Ruben Garcia Martinez
Hello everyone: I am a student of the University of Informatics Science in Cuba. I want create a postgresql cluster and I have two servers but I have a doubt. Is possible to create a cluster of postgresql server by sharing the database file on a SAN? Regards. Thank you very much for your tim

[GENERAL] Compiling with MinGW in windows , compile but my server down

2010-09-08 Thread Edwin Quijada
Hi!! I could compile my windows extension for Postgres but now when I try to run this extension my server goes down. I compiled using Mingw and this line C:\mingw\bin\gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv

Re: [GENERAL] how do i count() similar items

2010-09-08 Thread jackassplus
> > Use a CASE statement? > > something like: > select case WHEN os ~* E'^windows' then 'windows' > WHEN os ~* E'server' then 'server' > WHEN os ~* E'nix$' then '*nix' > else 'other' end > as osval, count(*) from os_tbl group by osval order by osval; > > The hard part is making sure your

Re: [GENERAL] variable name in plpgsql

2010-09-08 Thread Darren Duncan
zhong ming wu wrote: It seems that one cannot use the variable name that is the same as the column name of a relation like in the following function -- create or replace function bla() returns void language plpgsql as $$ declare email varchar; begin select email into email fr

Re: [GENERAL] Copy From csv file with double quotes as null

2010-09-08 Thread Craig Ringer
On 9/09/2010 2:48 AM, Donald Catanzaro, PhD wrote: So, latitude is a double precision column and I think that PostgreSQL is interpreting the double quote as a NULL string No, it's interpreting it as an empty string, not NULL. I suspect that's what you meant, but "NULL string" is still NULL, yo

Re: [GENERAL] variable name in plpgsql

2010-09-08 Thread Adrian Klaver
On Wednesday 08 September 2010 5:23:20 pm zhong ming wu wrote: > It seems that one cannot use the variable name that is the same as the > column name of a relation like in the following function > > -- > create or replace function bla() returns void language plpgsql as $$ > declare > emai

Re: [GENERAL] Empty SELECT result at simultaneous calls

2010-09-08 Thread Craig Ringer
On 8/09/2010 11:40 PM, Stefan Wild wrote: Hello, as already stated: "When I'm working with delays in the servlets, everything works fine." the same selects on the same id work fine if delayd. So the data should not be the problem. Is this freshly inserted data you're having issues with? If

[GENERAL] variable name in plpgsql

2010-09-08 Thread zhong ming wu
It seems that one cannot use the variable name that is the same as the column name of a relation like in the following function -- create or replace function bla() returns void language plpgsql as $$ declare email varchar; begin select email into email from pass where id=1;

Re: [GENERAL] "private" installation of postgres

2010-09-08 Thread Scott Ribe
On Sep 8, 2010, at 1:39 PM, Joshua J. Kugler wrote: > If you do a private socket dir, and connect via that, you don't even > have to listen on a TCP port at all. Right, but it's hardwired in that the IP port number is used as part of the domain socket name, and according to Tom also used someho

Re: [GENERAL] Memory Errors

2010-09-08 Thread Sam Nelson
My (our) complaints about EC2 aren't particularly extensive, but last time I posted to the mailing list saying they were using EC2, the first reply was someone saying that the corruption was the fault of EC2. Not that we don't have complaints at all (there are some aspects that are very frustratin

Re: [GENERAL] exclusion constraint with overlapping timestamps

2010-09-08 Thread Jeff Davis
On Wed, 2010-09-08 at 15:48 -0400, A.M. wrote: > I am experimenting with exclusion constraints via Depesz's excellent > introduction here: > http://www.depesz.com/index.php/2010/01/03/waiting-for-8-5-exclusion-constraints/ > > In the example, he uses non-overlapping (day) dates for hotel booking.

Re: [GENERAL] error while autovacuuming

2010-09-08 Thread Alvaro Herrera
Excerpts from tamanna madaan's message of mié sep 08 17:10:23 -0400 2010: > Actually, I have a cluster setup with two nodes in it. I am having > postgres-8.1.2 and am using slony-1.1.5 for replication between two > nodes in that cluster. Now, If I plan to upgrade both the servers to > postgres-8

Re: [GENERAL] error while autovacuuming

2010-09-08 Thread tamanna madaan
Hi All Thanks for your reply . Actually, I have a cluster setup with two nodes in it. I am having postgres-8.1.2 and am using slony-1.1.5 for replication between two nodes in that cluster. Now, If I plan to upgrade both the servers to postgres-8.1.21, I will be doing it one by one . When one s

Re: [GENERAL] Memory Errors

2010-09-08 Thread Tom Lane
Merlin Moncure writes: > On Wed, Sep 8, 2010 at 4:03 PM, Sam Nelson wrote: >> So ... yes, it seems that those four id's are somehow part of the problem. >> They're on amazon EC2 boxes (yeah, we're not too fond of the EC2 boxes >> either), so memtest isn't available, but no new corruption has crop

[GENERAL] Text search parser's treatment of URLs and emails

2010-09-08 Thread Thom Brown
Hi, I noticed that if I run this: SELECT alias, description, token FROM ts_debug('http://www.postgresql.org:2345/directory/page.html?version=9.1&build=alpha1#summary'); I get: alias | description | token --+---+-

Re: [GENERAL] error while autovacuuming

2010-09-08 Thread John R Pierce
On 09/08/10 12:11 PM, tamanna madaan wrote: Hi All Can a postgres patch for the fix ( provided in postgres-8.1.6 for autovacuum error ) be included with the postgres version I am using i.e postgres 8.1.2 so that I don't have to upgrade to 8.1.21 ?? Please reply here's a few good reasons t

Re: [GENERAL] Memory Errors

2010-09-08 Thread Merlin Moncure
On Wed, Sep 8, 2010 at 4:03 PM, Sam Nelson wrote: > It figures I'd have an idea right after posting to the mailing list. > Yeah, running COPY foo TO stdout; gets me a list of data before erroring > out, so I did a copy (select * from foo order by id asc) to stdout; to see > if I could make some ki

Re: [GENERAL] how do i count() similar items

2010-09-08 Thread Susan Cassidy
Use a CASE statement? something like: select case WHEN os ~* E'^windows' then 'windows' WHEN os ~* E'server' then 'server' WHEN os ~* E'nix$' then '*nix' else 'other' end as osval, count(*) from os_tbl group by osval order by osval; The hard part is making sure your regexes cover al

Re: [GENERAL] how do i count() similar items

2010-09-08 Thread bricklen
On Wed, Sep 8, 2010 at 12:22 PM, jackassplus wrote: > > >> To ensure data integrity, >> you should probably create a fruit_type table with a unique column that >> lists the possible types, and then foreign key the fruit_type column in >> the fruits table to that to ensure nothing funky is entered

Re: [GENERAL] error while autovacuuming

2010-09-08 Thread Michael Glaesemann
On Sep 8, 2010, at 16:15 , Scott Marlowe wrote: > On Wed, Sep 8, 2010 at 1:11 PM, tamanna madaan > wrote: >> >> >> Hi All >> >> Can a postgres patch for the fix ( provided in postgres-8.1.6 for >> autovacuum error ) be included with the postgres version I am using i.e >> postgres 8.1.2 so tha

Re: [GENERAL] error while autovacuuming

2010-09-08 Thread Scott Marlowe
On Wed, Sep 8, 2010 at 1:11 PM, tamanna madaan wrote: > > > Hi All > > Can a postgres patch for the fix ( provided in postgres-8.1.6 for > autovacuum error ) be included with the postgres version I am using i.e > postgres 8.1.2 so that I don't have to upgrade to 8.1.21 ?? > > Please reply If you

Re: [GENERAL] error while autovacuuming

2010-09-08 Thread tamanna madaan
Hi All Can a postgres patch for the fix ( provided in postgres-8.1.6 for autovacuum error ) be included with the postgres version I am using i.e postgres 8.1.2 so that I don't have to upgrade to 8.1.21 ?? Please reply Thanks... Tamanna -Original Message- From: tamanna madaan Sent: Fr

Re: [GENERAL] how do i count() similar items

2010-09-08 Thread jackassplus
  > To ensure data integrity, > you should probably create a fruit_type table with a unique column that > lists the possible types, and then foreign key the fruit_type column in > the fruits table to that to ensure nothing funky is entered.  An enum > for type is another possibility. In the real

Re: [GENERAL] Memory Errors

2010-09-08 Thread Sam Nelson
It figures I'd have an idea right after posting to the mailing list. Yeah, running COPY foo TO stdout; gets me a list of data before erroring out, so I did a copy (select * from foo order by id asc) to stdout; to see if I could make some kind of guess as to whether this was related to a single row

[GENERAL] exclusion constraint with overlapping timestamps

2010-09-08 Thread A.M.
I am experimenting with exclusion constraints via Depesz's excellent introduction here: http://www.depesz.com/index.php/2010/01/03/waiting-for-8-5-exclusion-constraints/ In the example, he uses non-overlapping (day) dates for hotel booking. In my case, I would like to use the same datatype but

Re: [GENERAL] "private" installation of postgres

2010-09-08 Thread Joshua J. Kugler
On Tuesday 07 September 2010, Scott Ribe elucidated thus: > On Sep 7, 2010, at 7:09 PM, Tom Lane wrote: > > Personally, though, I think it's easier to change the default port > > number and not worry about sharing /tmp. Changing the port is a > > good idea anyway to avoid any possible conflicts on

Re: [GENERAL] Memory Errors

2010-09-08 Thread Tom Lane
Sam Nelson writes: > pg_dump: Error message from server: ERROR: invalid memory alloc request > size 18446744073709551613 > pg_dump: The command was: COPY public.foo () TO stdout; > That seems like an incredibly large memory allocation request - it shouldn't > be possible for the table to really

Re: [GENERAL] how do i count() similar items

2010-09-08 Thread Darren Duncan
jackassplus wrote: lets say I hve the following in the 'fruits' table: Round orange Sunkist orange navel orange strawberry blueberry sunkist orange apple how would I get something like the following: count as c | Fruit type - 4 | orange 2

Re: [GENERAL] Memory Errors

2010-09-08 Thread Scott Marlowe
On Wed, Sep 8, 2010 at 12:56 PM, Sam Nelson wrote: > Hey, a client of ours has been having some data corruption in their > database.  We got the data corruption fixed and we believe we've discovered > the cause (they had a script killing any waiting queries if the locks on > their database hit 100

[GENERAL] Memory Errors

2010-09-08 Thread Sam Nelson
Hey, a client of ours has been having some data corruption in their database. We got the data corruption fixed and we believe we've discovered the cause (they had a script killing any waiting queries if the locks on their database hit 1000), but they're still getting errors from one table: pg_dum

Re: [GENERAL] Copy From csv file with double quotes as null

2010-09-08 Thread Donald Catanzaro, PhD
Hi All, I am apparently totally misreading how to import data using the COPY FROM command, can someone give assistance ? I have two issues, both dealing with double quotes as NULL. The data is CSV with NULL being represented by a double quote (e.g. "") in all columns of the table. ISSUE

Re: [GENERAL] how do i count() similar items

2010-09-08 Thread Bill Moran
In response to jackassplus : > lets say I have the following in the 'fruits' table: > > Round orange > Sunkist orange > navel orange > strawberry > blueberry > sunkist orange > apple > > how would I get something like the following: > > count as c | Fruit type >

Re: [GENERAL] Postgres 32bit on Windows 64bit, related components

2010-09-08 Thread Brar Piening
On Wed, 8 Sep 2010 11:31:47 +1000, Brendan Hill wrote: We're about to purchase a new server for our Postgres 8.4 database. We'd like to go with Windows 64bit for possible future developments, but are happy to stick with 32bit Postgres + Npgsql, ODBC, OpenSSL, slony2 and libxml2, libpq. [

[GENERAL] how do i count() similar items

2010-09-08 Thread jackassplus
lets say I hve the following in the 'fruits' table: Round orange Sunkist orange navel orange strawberry blueberry sunkist orange apple how would I get something like the following: count as c | Fruit type - 4 | orange 2 | berry 1

Re: [GENERAL] Empty SELECT result at simultaneous calls

2010-09-08 Thread Stefan Wild
> Excerpts from Stefan Wild's message > of mié sep 08 11:40:25 -0400 2010: > > Hello, > > > > as already stated: "When I'm working with delays in > the servlets, everything works fine." the same selects on > the same id work fine if delayd. So the data should not be > the problem. > > So why are

Re: [GENERAL] Empty SELECT result at simultaneous calls

2010-09-08 Thread Alvaro Herrera
Excerpts from Stefan Wild's message of mié sep 08 11:40:25 -0400 2010: > Hello, > > as already stated: "When I'm working with delays in the servlets, everything > works fine." the same selects on the same id work fine if delayd. So the data > should not be the problem. So why are you blaming Po

Re: [GENERAL] Empty SELECT result at simultaneous calls

2010-09-08 Thread Stefan Wild
Hello, as already stated: "When I'm working with delays in the servlets, everything works fine." the same selects on the same id work fine if delayd. So the data should not be the problem. regards, Stefan Wild --- Tom Lane schrieb am Mi, 8.9.2010: > Von: Tom Lane > Betreff: Re: [GENERAL] Em

Re: [GENERAL] joins with text search

2010-09-08 Thread Sam Mason
On Tue, Sep 07, 2010 at 10:42:53PM -0400, p...@slatech.com wrote: > i am currently populating the textsearch column with the following > command: > > UPDATE > products > SET > textsearch=setweight(to_tsvector('english', description), 'A') || > setweight(to_tsvector('english', part_number, 'B')

Re: [GENERAL] Postgres 32bit on Windows 64bit, related components

2010-09-08 Thread Dave Page
On Wed, Sep 8, 2010 at 9:29 AM, Magnus Hagander wrote: > On Wed, Sep 8, 2010 at 03:31, Brendan Hill wrote: >> We're about to purchase a new server for our Postgres 8.4 database. We’d >> like to go with Windows 64bit for possible future developments, but are >> happy to stick with 32bit Postgres +

[GENERAL] PostgreSQL article online - PDF

2010-09-08 Thread Thomas Uzunoff
Hello, Pavel Stehule wrote an article for Linux Technical Review which is published now. The language is German. It's regarding PostgreSQL and its possibilities with e.g. Stored Procedures. The first 100 downloads are sponsored by Linux Technical Review. Feel free to download the PDF and to rea

Re: [GENERAL] Postgres 32bit on Windows 64bit, related components

2010-09-08 Thread Magnus Hagander
On Wed, Sep 8, 2010 at 03:31, Brendan Hill wrote: > We're about to purchase a new server for our Postgres 8.4 database. We’d > like to go with Windows 64bit for possible future developments, but are > happy to stick with 32bit Postgres + Npgsql, ODBC, OpenSSL, slony2 and > libxml2, libpq. > > > >

Re: [GENERAL] Postgres 32bit on Windows 64bit, related components

2010-09-08 Thread Brendan Hill
Hi Jayadevan, We're adding to our server farm, which is Windows. We use Windows as our application is .NET based, and related components in our systems require Windows. Switching to *nix is not an option. I'm just after some assurance that all the extra 32bit components in Postgres will run OK