Re: [GENERAL] looping over a small record set over and over in a function

2009-06-20 Thread Alban Hertroys
On Jun 19, 2009, at 8:23 PM, Ivan Sergio Borgonovo wrote: I've a record set on which I have to loop several times. The function should return the same record set + one more computed field. Something that in could look like: foreach(row) { // compute stuff if(...) { } // place stuff in field[

Re: [GENERAL] Disaster recovery (server died)

2009-06-20 Thread Alan McKay
On Sat, Jun 20, 2009 at 12:45 AM, Uwe C. Schroeder wrote: > What I don't get is this: you said your CPU died. For me that's the processor > or maybe some interpret that as the main board. > So why don't you grab the harddisk from that server and plug it into the new > one? x 2 Should work fine.

Re: [GENERAL] Disaster recovery (server died)

2009-06-20 Thread Madison Kelly
Uwe C. Schroeder wrote: On Friday 19 June 2009, Scott Marlowe wrote: On Fri, Jun 19, 2009 at 8:43 PM, Miguel Miranda wrote: Well, i just didnt explain in detail, what i have is just the 16897 directory where i was storing the database, i tried just copying the files but it didnt work, should i

Re: [GENERAL] running pg_dump from python

2009-06-20 Thread Jasen Betts
On 2009-06-18, Erik Jones wrote: > > On Jun 15, 2009, at 5:17 AM, Jasen Betts wrote: > >> On 2009-06-14, Garry Saddington wrote: >>> I ahve the following python file that I am running as an external >>> method >>> in Zope. >>> >>> def backup(): >>>import os >>>os.popen("c:/scholarpack/

Re: [GENERAL] looping over a small record set over and over in a function

2009-06-20 Thread Ivan Sergio Borgonovo
On Sat, 20 Jun 2009 12:30:42 +0200 Alban Hertroys wrote: > You could add a column to your query as a placeholder for the > computed value. > For example, SELECT *, 0 AS computed_value FROM table. > If you use a scrollable cursor (possible in PL/pgSQL these days, > although it still has some li

Re: [GENERAL] Dynamic table

2009-06-20 Thread Hartman, Matthew
Isn't a many-to-one relationship the classic example of a child table? Have one parent table that assigns a primary key. "PARENT" with "PARENT_ID". Have a child table that has a name and value column. "CHILD" with "PARENT_ID", "COLUMN_NAME", and "COLUMN_VALUE". Perform joins as you see fit to

Re: [GENERAL] looping over a small record set over and over in a function

2009-06-20 Thread John DeSoi
On Jun 20, 2009, at 8:35 AM, Ivan Sergio Borgonovo wrote: And lastly, if your current approach really is the only way to compute what you're after, then maybe PL/pgSQL isn't the right match for the problem; it looks like you'd be better served by a Yeah. I gave a look to python but I don't wa

[GENERAL] where is the table?

2009-06-20 Thread sergio nogueira
Hi, all. Where is the table? dmonitor=> create table wereisthetable(col int); CREATE TABLE dmonitor=> select tablename, tablespace from pg_tables where tablename='wereisthetable'; tablename| tablespace + wereisthetable | (1 row) dmonitor=> alter table wereisth

[GENERAL] Benetl, a free ETL tool for files using postgreSQL, is out in version 2.8

2009-06-20 Thread benoît carpentier
Dear all, Benetl, a free ETL tool for files using postgreSQL, is out in version 2.8. You can freely download it at: www.benetl.net A new function, two GUI improvements, you should update. You can learn more about ETL tools at: http://en.wikipedia.org/wiki/Extract,_transform,_load Thanks for

Re: [GENERAL] pl/sql resources for pl/pgsql?

2009-06-20 Thread Merlin Moncure
On Sat, Jun 20, 2009 at 1:54 AM, Gurjeet Singh wrote: > On Sat, Jun 20, 2009 at 10:52 AM, Jasen Betts wrote: >> >> On 2009-06-16, gvimrc wrote: >> > I'm fairly new to PostgreSQL and completely new to using pl/pgsql >> > though I've used MySQL's procedural language a little. >> > I heard pl/pgsql

Re: [GENERAL] pl/sql resources for pl/pgsql?

2009-06-20 Thread Pavel Stehule
Hi it is funny, so I found similar rules for developing plpgsql :) > > *) style: > I suggest prefixing all local variables, including inputs to and > outputs from functions.  I prefix my variables with an underscore.  If > you neglect to do this you will end up having name clashes with your > tab

[GENERAL] Implicit conversion/comparision of timestamp with and without timezone

2009-06-20 Thread Gerhard Wiesinger
Hello, It is unclear to me how implicit conversion/comparision of timestamp with and without timezone works. -- -- datetime TIMESTAMP WITH TIME ZONE -- datetime entries are with UTC+01 and UTC+02 done -- 2009-03-09: UTC+01 -- 2009-06-12: UTC+02 -

Re: [GENERAL] looping over a small record set over and over in a function

2009-06-20 Thread Craig Ringer
On Fri, 2009-06-19 at 20:23 +0200, Ivan Sergio Borgonovo wrote: > If I could easily load all the dataset into an array, loop through > it and then just update the computed field it would be nice... but > how? Are you sure you _really_ need a PL/PgSQL function for this? Can't you: SELECT x.*, co