Re: [SQL] is there a way to get hh:mm:ss given seconds

2002-07-09 Thread Christopher Kings-Lynne
> > I tried all these. This is what I get > > SQL> SELECT "interval"(cast(422 as varchar) || ' seconds'); > > SELECT "interval"(cast(422 as varchar) || ' seconds') > > * > > ERROR at line 1: > > ORA-00906: missing left parenthesis > > > SQL> select '422 second

Re: [SQL] is there a way to get hh:mm:ss given seconds

2002-07-09 Thread Josh Berkus
Narendra, > I tried all these. This is what I get > SQL> SELECT "interval"(cast(422 as varchar) || ' seconds'); > SELECT "interval"(cast(422 as varchar) || ' seconds') > * > ERROR at line 1: > ORA-00906: missing left parenthesis > SQL> select '422 seconds'::i

Re: [SQL] pg_restore cannot restore index

2002-07-09 Thread Bruce Momjian
Yep, documentation is wrong. Documentation patch attached and applied. Also, in 7.3 you will not need the weird quoting for objects. --- Jie Liang wrote: > Another possible bug: > pg_restore -i "\"indexname\"" -d mydb myd

Re: [SQL] pg_restore cannot restore index

2002-07-09 Thread Jie Liang
Another possible bug: pg_restore -i "\"indexname\"" -d mydb mydumpfile msg: pg_restore: connecting to database for restore pg_restore: creating FUNCTION "plpgsql_call_handler" () pg_restore: [archiver (db)] could not execute query: ERROR: function plpgsql_call_handler already exists with same

[SQL] pg_restore cannot restore index

2002-07-09 Thread Jie Liang
Another possible bug: pg_restore -i "\"indexname\"" -d mydb mydumpfile msg: pg_restore: connecting to database for restore pg_restore: creating FUNCTION "plpgsql_call_handler" () pg_restore: [archiver (db)] could not execute query: ERROR: function plpgsql_call_handler already exists with same arg

Re: [SQL] is there a way to get hh:mm:ss given seconds

2002-07-09 Thread Kevin Brannen
Tod McQuillin wrote: > On Mon, 8 Jul 2002, Narendra A wrote: > > >>Is there a way in sql such that if I give seconds it should me return me >>hours:mins:seconds >> >>Eg. Seconds hh:mm:ss >>422 1:01:02 > > > foo=# select '422 seconds'::interval; > interval > -- > 00:0

Re: [SQL] PLPGSQL language documentation

2002-07-09 Thread Jeff Eckermann
I'll second the suggestion about looking at Oracle PL/SQL materials. I used an introductory PL/SQL text when learning about PLpgSQL, and found it very useful. The syntax/functionality is highly similar (by design, apparently). Much of the Oracle PL/SQL functionality is not (yet) implemented in P

[SQL] Waiting for Update

2002-07-09 Thread JGM
Could it be true?? I've a table with < 46000 rows. And a little Update like UPDATE foo set xxx = 'X'; needs about 15 seconds??? What's wrong? Greetings Juergen ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] export plpgsql function to file

2002-07-09 Thread Achilleus Mantzios
On 9 Jul 2002, Joseph Syjuco wrote: select prosrc from pg_proc where proname='foofunc'; The other way is dumping the database and extracting afterwards only the create statement of your function > how can i export my postgresql function to a file? > > > > > > > ---

Re: [SQL] PLPGSQL language documentation

2002-07-09 Thread Bradley Kieser
Hear hear! We have been looking for it as well! We have avoided using triggers to date because we do not know how to program in the language! Sandy Ear wrote: > I was wondering if anyone knew of good online documentation on PlPgsql? > > > > > > ---(end of broadcast)

Re: [SQL] PLPGSQL language documentation

2002-07-09 Thread Josh Berkus
Sandy, > I was wondering if anyone knew of good online documentation on PlPgsql? Read two things: 1. the online docs for PostgreSQL 7.2 under "Programmer's guide: Procedural Languages" 2. Roberto' Mello's enhanced documentation, accessable through techdocs.postgresql.org. Roberto also has a

Re: [SQL] is there a way to get hh:mm:ss given seconds

2002-07-09 Thread Tod McQuillin
On Mon, 8 Jul 2002, Narendra A wrote: > Is there a way in sql such that if I give seconds it should me return me > hours:mins:seconds > > Eg. Seconds hh:mm:ss > 422 1:01:02 foo=# select '422 seconds'::interval; interval -- 00:07:02 (1 row) -- Tod McQuillin --

Re: [SQL] is there a way to get hh:mm:ss given seconds

2002-07-09 Thread David Stanaway
On Mon, 2002-07-08 at 09:28, Narendra A wrote: > Sir, > Is there a way in sql such that if I give seconds it should me return me > hours:mins:seconds > > Eg. Seconds hh:mm:ss > 422 1:01:02 scratch=# SELECT 422::interval; interval -- 00:07:02 (1 row) scratch=# \q dst

Re: [SQL] INSERT only under certain conditions (SELECT)

2002-07-09 Thread Bruno Wolff III
On Mon, Jul 08, 2002 at 17:49:56 +0200, Joachim Trinkwitz <[EMAIL PROTECTED]> wrote: > > Now I want to allow a user with id 123 only to insert a row in T if he > doesn't choose values from L with same 'art' and 'semester' values -- > in the examples user 123 has already chosen a kvvnr from seme

Re: [SQL] Rule WHERE condition problem

2002-07-09 Thread Jan Wieck
Kristian Eide wrote: > > I have a table with a reference constraint and an ON DELETE SET NULL action. > When this action triggers, I also want to update another field in the table, > actually a timestamp which should be set to NOW(). > > After reading some documentation it would seem a rule is t

Re: [SQL] newbie question

2002-07-09 Thread Christopher Kings-Lynne
> Transactions (well, recently mysql allows them but using propietary > extensions), foreign key relationships, subqueries, stored > procedures/triggers. MySQL lacks all of these. MySQL's InnoDB tables have foreign keys, but they are RESTRICT only - ie. they're kinda useless. > On the other side

Re: [SQL] newbie question

2002-07-09 Thread Achilleus Mantzios
On Sun, 7 Jul 2002, Mirco D'Angelo wrote: > Hi > > I am going to learn MySql 'cause I have to, but would it be better, or let's > say, more interesting, to learn postgressql? Is it newer, more common, etc.? > Well IMO you just cant compare them. Think of a porche that does 100km/h better than

[SQL] is there a way to get hh:mm:ss given seconds

2002-07-09 Thread Narendra A
Sir, Is there a way in sql such that if I give seconds it should me return me hours:mins:seconds   Eg. Seconds hh:mm:ss 422  1:01:02   eagerly waiting for response.   Regards Narendra DISCLAIMER: This email is bound by the terms and conditions described at htt

Re: [SQL] Rule WHERE condition problem

2002-07-09 Thread Kristian Eide
>> ERROR: query rewritten 10 times, may contain cycles >> It would seem that my WHERE clause is not checked before the action is run. >No, the WHERE clause is essentially transformed into part of the rule >query. You can't ever write a rule of the form > ON UPDATE TO b DO UPDATE b ... >bec

[SQL] PLPGSQL language documentation

2002-07-09 Thread Sandy Ear
I was wondering if anyone knew of good online documentation on PlPgsql? ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Rule WHERE condition problem

2002-07-09 Thread Tom Lane
"Kristian Eide" <[EMAIL PROTECTED]> writes: > ERROR: query rewritten 10 times, may contain cycles > It would seem that my WHERE clause is not checked before the action is run. No, the WHERE clause is essentially transformed into part of the rule query. You can't ever write a rule of the form

[SQL] Variables in PSQL

2002-07-09 Thread Roger Mathis
Hi I'm trying to declare a variable in PostgreSQL, so I can save some values in it. After, I want to calculate with this variable. For example: declare vp integer; select price into :vp from article where anr = 1; vp := vp + 1; update article set price = :vp where anr = 1; Is there a posibility

[SQL] SQL problem with aggregate functions.

2002-07-09 Thread David BOURIAUD
Hi the list ! I've got a table in which there is a field that can have one amongst 3 possible values : D, R, X. Is it possible to get in one query the count of this different values.Please, note that I don't want to have a querry like this : "select count (*) from tab group by f1;", cause i wan

[SQL] export plpgsql function to file

2002-07-09 Thread Joseph Syjuco
how can i export my postgresql function to a file? ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Re: [SQL]

2002-07-09 Thread Bruce Momjian
jack wrote: > Hi, > Regarding temp tables in the same connection session. If there is SQL > procedure creating temp tables, process temp tables and drop all the temp > tables finally. This SQL procedure can't run twice in the same session. > Because all the temp tables are referred to the first ph

Re: [SQL] how to write procedures

2002-07-09 Thread Bhuvan A
Hi, it seems you weren't yet installed appropriate procedural language. for example, if you wish to code in plpgsql you must install 'plpgsql'. for details refer the documentation and it has enough information. regards, bhuvaneswaran. On Thu, 4 Jul 2002, srikanth wrote: > Hi, I am using post