Re: [SQL] date_trunc for 5 minutes intervals

2003-10-20 Thread Richard Huxton
On Sunday 19 October 2003 14:38, email lists wrote: > Hi All, > > I am wanting to perform the equivalent of date_trunc to 5/10/15 minute > intervals. As this does mnot seem to be natively supported by > date_trunc, can anyone point me in the right direction to possible write > the SQL ro acheive th

[SQL] query or design question

2003-10-20 Thread Adam Witney
Hi, I have a table like so CREATE TABLE imagene ( id int bioassay_idint gene_idtext s_row int s_column int s_meta_row int s_meta_column int sig_median numeric bkg_median numeric ); Rows are unique on (bioassay_id, gene_id, s_row, s_column, s_me

Re: [SQL] Max input parameter for a function

2003-10-20 Thread Christopher Browne
After a long battle with technology,[EMAIL PROTECTED] ("Kumar"), an earthling, wrote: > While trying to allocate about 36 input parameters, I got an error saying that the > max input parameter for a function is only 32. > > Is it right? How to overcome this? Because I wanna insert records into a t

[SQL] Unable to user pg_restore

2003-10-20 Thread Kumar
Dear Friends,   I have created a compressed backup for the database - sampledb using the following $ pg_dump -h 192.128.2.51 -v -u -f /home/db_repository/sampledb20031020.sql.tar.gz wats -F c   while I try to restore this with the pg_restore function as follows $ pg_restore -d sampledbtest -

[SQL] Question regarding triggers

2003-10-20 Thread Dmitri Fuerle
     I'm writing a trigger but running into problems.  My problem is that I can not determine anyway to tell what fields are in the *new* record.  Without knowing what fields are there I get runtime errors if that's not what is being updated example:   CREATE FUNCTION "public"."check_shipment" ()

[SQL] Scripting only the functions

2003-10-20 Thread Kumar
Dear Friends,   I am working with Postgres 7.3.4 on RH Linux server 7.2.   Using pg_dump I could manage to take a script for all the DB objects. But wanted to take the script (DDL) for all the scripts in my database. While I searched I dont find any options in the pg_dump except for script ta

Re: [SQL] Question regarding triggers

2003-10-20 Thread achill
Why dont you try to write your trigger in C? On Mon, 20 Oct 2003, Dmitri Fuerle wrote: > >I'm writing a trigger but running into problems. My problem is that I can not > determine anyway to tell what fields are in the *new* record. Without knowing what > fields are there I get runtime e

Re: [SQL] Question regarding triggers

2003-10-20 Thread A.Bhuvaneswaran
> Why dont you try to write your trigger in C? Hi, one cannot write triggered procedures in C. Currently, it can only be written in plpsgql. > > CREATE FUNCTION "public"."check_shipment" () RETURNS trigger AS' > > begin > > If new.shipment_type_id = 4 then > > --do something > > e

Re: [SQL] [postgres] PostgreSQL-DB auf Web-Schnittstelle bringen

2003-10-20 Thread Alvar Freude
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 - -- [EMAIL PROTECTED] wrote: > Welches Verfahren/Vorgehen würdet Ihr mir denn empfehlen, wenn ich eine > PostgreSQL- Datenbank auf eine Web-Schnittstelle bringen will? was meinst Du denn damit genau? Du hast irgendeine Applikation die ihre Daten

Re: [SQL] Question regarding triggers

2003-10-20 Thread achill
On Mon, 20 Oct 2003, A.Bhuvaneswaran wrote: > > Why dont you try to write your trigger in C? > > Hi, one cannot write triggered procedures in C. Currently, it can only be > written in plpsgql. Where did you get that impression from? Do an SELECT tgrelid,tgfoid,proname from pg_trigger,pg_proc wh

Re: [SQL] Question regarding triggers

2003-10-20 Thread Tom Lane
"A.Bhuvaneswaran" <[EMAIL PROTECTED]> writes: >> Why dont you try to write your trigger in C? > Hi, one cannot write triggered procedures in C. Oh? All the built-in trigger procedures are. regards, tom lane ---(end of broadcast)--

Re: [SQL] Question regarding triggers

2003-10-20 Thread Dmitri Fuerle
  Thanks for the help.  I discovered my error while coming up with a better example.     Thanks,   Dmitri"A.Bhuvaneswaran" <[EMAIL PROTECTED]> wrote: > Why dont you try to write your trigger in C?Hi, one cannot write triggered procedures in C. Currently, it can only bewritten in plpsgql.> > CREATE

Re: [SQL] [postgres] PostgreSQL-DB auf Web-Schnittstelle bringen

2003-10-20 Thread Alvar Freude
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hallo, - -- Ian Barwick <[EMAIL PROTECTED]> wrote: > Fuer diese Aufgabe wuerde sich eignen z.B. phpPgAdmin: > http://phppgadmin.sourceforge.net/ vor einiger Zeit hatte ich mir das mal angeschaut -- und fand das nur grauselig. OK, besser als nichts.

Re: [SQL] Which is faster SQL or PL/PGSQL

2003-10-20 Thread Michael Pohl
On Sun, 19 Oct 2003, Christopher Browne wrote: > The world rejoiced as [EMAIL PROTECTED] ("George A.J") wrote: > > i am converting an MSSQL database to Postgres. there is a lot of > > procedures to convert. > > > > which language is best for functions, SQL or plpgsql. > > > > which is faster . i a

Re: [SQL] Which is faster SQL or PL/PGSQL

2003-10-20 Thread Richard Huxton
On Monday 20 October 2003 16:36, Michael Pohl wrote: > On Sun, 19 Oct 2003, Christopher Browne wrote: > > The world rejoiced as [EMAIL PROTECTED] ("George A.J") wrote: > > > i am converting an MSSQL database to Postgres. there is a lot of > > > procedures to convert. > > > > > > which language is b

Re: [SQL] query or design question

2003-10-20 Thread Richard Huxton
On Monday 20 October 2003 11:58, Adam Witney wrote: > Hi, > > I have a table like so > > CREATE TABLE imagene ( > id int > bioassay_idint > gene_idtext > s_row int > s_column int > s_meta_row int > s_meta_column int > sig_median numeric > bkg_median

Re: [SQL] Unable to user pg_restore

2003-10-20 Thread Tom Lane
"Kumar" <[EMAIL PROTECTED]> writes: > $ pg_restore -d sampledbtest -f /home/db_repositorysampledb.sql.tar.gz -F c= > -v -c -O -h 192.128.2.51 -p 5432 -u > User name: postgres This is the wrong way to invoke pg_restore. "-f file" is an *output* file name. -d and -f are mutually contradictory opt

Re: [SQL] Which is faster SQL or PL/PGSQL

2003-10-20 Thread Joe Conway
Richard Huxton wrote: So - gain by not re-planning on every call, but maybe lose because your plan is not so precise. Of course, any queries you build dynamically and run via EXECUTE will have to be planned each time. This question gets even more complex in 7.4, where many simple SQL functions

Re: [SQL] Scripting only the functions

2003-10-20 Thread Richard Huxton
On Monday 20 October 2003 14:04, Kumar wrote: > Dear Friends, > > I am working with Postgres 7.3.4 on RH Linux server 7.2. > > Using pg_dump I could manage to take a script for all the DB objects. But > wanted to take the script (DDL) for all the scripts in my database. While I > searched I dont fi

Re: [SQL] Scripting only the functions

2003-10-20 Thread Josh Berkus
Kumar, > Using pg_dump I could manage to take a script for all the DB objects. But > wanted to take the script (DDL) for all the scripts in my database. While I > searched I dont find any options in the pg_dump except for script tables > only. > > Is there a way? Currently, no. -- Josh Berkus A

Re: [SQL] Which is faster SQL or PL/PGSQL

2003-10-20 Thread Richard Huxton
On Monday 20 October 2003 18:24, Joe Conway wrote: > Richard Huxton wrote: > > So - gain by not re-planning on every call, but maybe lose because your > > plan is not so precise. > > > > Of course, any queries you build dynamically and run via EXECUTE will > > have to be planned each time. > > This

Re: [SQL] Which is faster SQL or PL/PGSQL

2003-10-20 Thread Joe Conway
Richard Huxton wrote: On Monday 20 October 2003 18:24, Joe Conway wrote: This question gets even more complex in 7.4, where many simple SQL functions will get inlined, and library preloading is available to speed that first PL/pgSQL call. What will be the effects of inlining? Does it mean the plann

Re: [SQL] Which is faster SQL or PL/PGSQL

2003-10-20 Thread Josh Berkus
Joe, > Yes, I believe so (well, actually the optimizer). An inlined SQL > function ends up behaving like a macro that expands at run time and is > therefore quite fast -- no function call overhead at all. ... but only in 7.4. In 7.2 and I think in 7.3 this was not implemented. While we're on

[SQL] Crosstab question

2003-10-20 Thread Adam Witney
Hi, I am trying to figure out the use of crosstab(text sql, int N) The sql I have is cabbage=# select geneid, bioassay_id, sig_median from imagene order by 1,2; geneid | bioassay_id | sig_median -+-+ 16s rRNA (AP

Re: [SQL] Which is faster SQL or PL/PGSQL

2003-10-20 Thread Joe Conway
Josh Berkus wrote: Yes, I believe so (well, actually the optimizer). An inlined SQL function ends up behaving like a macro that expands at run time and is therefore quite fast -- no function call overhead at all. ... but only in 7.4. In 7.2 and I think in 7.3 this was not implemented. Yeah, tha

Re: [SQL] Which is faster SQL or PL/PGSQL

2003-10-20 Thread Josh Berkus
Joe, > Never tried it, but is it possible to use a prepared statement inside a > PL/pgSQL function? In any case, you can in other PLs. And with library > preloading (starting in 7.4), the first call to other PLs is similar to > that of PL/pgSQL. See: >http://archives.postgresql.org/pgsql-pa

Re: [SQL] Which is faster SQL or PL/PGSQL

2003-10-20 Thread Tom Lane
Joe Conway <[EMAIL PROTECTED]> writes: > Josh Berkus wrote: >> While we're on the topic, anyone know any good ways to speed up EXECUTE >> statements in PL/pgSQL functions? > Never tried it, but is it possible to use a prepared statement inside a > PL/pgSQL function? You could probably EXECUTE p

Re: [SQL] Crosstab question

2003-10-20 Thread Joe Conway
Adam Witney wrote: The missing values seemed to have been ignored and so the data is being shifted to the left and so put in the wrong columns. Am I using this function correctly? What is supposed to happen with missing values? Yeah, that's a limitation of the version of crosstab distributed with

Re: [SQL] Which is faster SQL or PL/PGSQL

2003-10-20 Thread Josh Berkus
Tom, > AFAICS, the whole point of EXECUTE in plpgsql is that it doesn't take > any shortcuts, and so the answer to Josh's question can only be "don't > use EXECUTE"... Yeah, that's what I thought, I was just hoping for some low-hanging fruit. -- -Josh Berkus Aglio Database Solutions San Franc

Re: [SQL] [postgres] PostgreSQL-DB auf Web-Schnittstelle bringen

2003-10-20 Thread weigelt
On Mon, Oct 20, 2003 at 12:36:01PM +0200, Volker G?bbels wrote: > Und DB-Modelle sollte man eh besser grafisch entwickeln ... Richtig. Zettel und Stift sind genauso unersetzlich wie awk+sed. cu -- - Enrico Weigelt== me

[SQL] converting an oracle procedure to postgres

2003-10-20 Thread Clint Stotesbery
I have read the docs on converting Oracle to Postgres already. I'm a little confused though. I have a procedure in Oracle that just does some calculations and then does an update based on the calculations. The procedure doesn't return anything. It seems like in Postgres that everything has to b

Re: [SQL] converting an oracle procedure to postgres

2003-10-20 Thread Josh Berkus
Clint, > v_taxstatus varchar(1); > v_shipping varchar(12); Drop the varchar limits, it's not supported inside PL/pgSQL. > I know I have to relpace the word PROCEDURE with FUNCTION but then it wants > me to put RETURNS but I don't want to return anything. I was > thinking that I

Re: [SQL] converting an oracle procedure to postgres

2003-10-20 Thread Tom Lane
"Clint Stotesbery" <[EMAIL PROTECTED]> writes: > I know I have to relpace the word PROCEDURE with FUNCTION but then it wants > me to put RETURNS but I don't want to return anything. You can say RETURNS VOID in recent releases. This is a bit of a hack but it expresses your intent ... you still h

[SQL] [postgres] Deutsche PostgreSQL-Mailingliste unter postgresql.org

2003-10-20 Thread Peter Eisentraut
Hallo Allerseits, ich habe mit Marc Fournier vereinbart, dass wir eine deutsche PostgreSQL-Mailingliste unter postgresql.org anlegen können. Ich denke, das würde der Einheitlichkeit des Auftretens entgegen kommen, zumal es auch schon eine französische und eine türkische gibt. Was haltet ihr also

Re: [SQL] [postgres] Deutsche PostgreSQL-Mailingliste unter

2003-10-20 Thread Alvar Freude
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 - -- Peter Eisentraut <[EMAIL PROTECTED]> wrote: > Was haltet ihr also davon, die ganze Operation dorthin zu verlegen? ja, da bin ich eindeutig dafür. Dies dürfte auch den positiven Nebeneffekt haben, dass hier etwas mehr los ist und interessierte

Re: [SQL] [postgres] Deutsche PostgreSQL-Mailingliste unter postgresql.org

2003-10-20 Thread weigelt
On Mon, Oct 20, 2003 at 07:53:42PM +0200, Peter Eisentraut wrote: > Was haltet ihr also davon, die ganze Operation dorthin zu verlegen? Halte ich für sinnvoll. cu -- - Enrico Weigelt== metux IT services phone: +49

[SQL] assorted Postgres SQL/ORDBMS questions

2003-10-20 Thread Clint Stotesbery
1. You can raise exceptions but you can't catch exceptions in pgsql right? 2. Does Postgres support ORDBMS operations? Specifically I am wondering about the ability to define your own objects and create functions/procedures for the objects (e.g. object.method()). In Oracle I would use CREATE TYPE

Re: [SQL] [postgres] Deutsche PostgreSQL-Mailingliste unter postgresql.org

2003-10-20 Thread Ewald Geschwinde
Peter Eisentraut wrote: >Hallo Allerseits, > >ich habe mit Marc Fournier vereinbart, dass wir eine deutsche >PostgreSQL-Mailingliste unter postgresql.org anlegen können. Ich denke, >das würde der Einheitlichkeit des Auftretens entgegen kommen, zumal es >auch schon eine französische und eine türki

Re: [SQL] assorted Postgres SQL/ORDBMS questions

2003-10-20 Thread Josh Berkus
Clint, > 1. You can raise exceptions but you can't catch exceptions in pgsql right? right. We'd like to do exception-trapping, but nobody has offered to program it. > 2. Does Postgres support ORDBMS operations? > Specifically I am wondering about the ability to define your own objects > and cr

Re: [SQL] assorted Postgres SQL/ORDBMS questions

2003-10-20 Thread Tom Lane
Josh Berkus <[EMAIL PROTECTED]> writes: >> 4. Can dates only be storied in -MM-DD format? > Dates are stored in an internal format in order to ensure compliance with the > SQL date standard. The DATE type is stored as an integer; the TIMESTAMP is > (I believe) binary. Just to clarify: dates