Re: [SQL] pl/pgsql - code review + question

2001-07-18 Thread Josh Berkus
Tom, Folks, > > Don't know why the parser for RAISE doesn't like string concat. > > Laziness ;-). Someone should fix plpgsql so that RAISE does take > expressions, not just literals and simple variables. It probably > wouldn't be a big change, but I've no time to look at it myself; > any volun

Re: [SQL] How Postgresql Compares For Some Query Types

2001-07-18 Thread markir
> > I'm a little unclear on what a "fact table" is. Can you explain? Good question... The idea comes from data warehousing where a typical data construction involves two "types" of table : dimensions : time, location, ethicity( essentially denormalized lookups ) facts : observ

Re: [SQL] pl/pgsql - code review + question

2001-07-18 Thread Tom Lane
"Richard Huxton" <[EMAIL PROTECTED]> writes: > Don't know why the parser for RAISE doesn't like string concat. Laziness ;-). Someone should fix plpgsql so that RAISE does take expressions, not just literals and simple variables. It probably wouldn't be a big change, but I've no time to look at

Re: [SQL] What is the syntax turn off auto commit?

2001-07-18 Thread Stephan Szabo
On Wed, 18 Jul 2001, Raymond Chui wrote: > > > The Subject says its all. > > To speed up a bulk of INSERTs, I need to turn-off the auto commit 1st. > Then > at the end of INSERTs, issue COMMIT; > What is the syntax to turn off the auto commit? Thank you! Put them in an explicit transaction

Re: [SQL] pl/pgsql - code review + question

2001-07-18 Thread Tom Lane
Gary Stainburn <[EMAIL PROTECTED]> writes: > My problem now is that when I include the code to handle the record > not being there, from the pgsql chapter (section 23.2.3.3) I get the > following errors based of the function below. IIRC, there's an erroneous example in the 7.1 plpgsql documentati

Re: [SQL] pl/pgsql - code review + question

2001-07-18 Thread Richard Huxton
From: "Gary Stainburn" <[EMAIL PROTECTED]> > My problem now is that when I include the code to handle the record not being > there, from the pgsql chapter (section 23.2.3.3) I get the following errors Hey - stop that! If everyone starts reading the docs and quoting chapter refs all we'll be left

[SQL] RE: pl/pgsql - code review + question

2001-07-18 Thread Jeff Eckermann
If the string will always be in that general form, use substring & position functions (see "String Functions and Operators" in the docs. Example: unit_number := substr(team_number, strpos(team_number, ''-'') + 1); If you don't want the leading zero, you could make make the "+1" into "+2". If you m

Re: [SQL] pl/pgsql - code review + question

2001-07-18 Thread Richard Huxton
From: "Gary Stainburn" <[EMAIL PROTECTED]> > Hi all, I've just written my first pl/pgsql function (code included below for > you to pull apart). Looks fine to me. Try it with "SELECT INTO" etc rather than "select into" and see if you prefer it - I find it makes the variables/fields stand out be

[SQL] RE: pl/pgsql - code review + question

2001-07-18 Thread Jeff Eckermann
I think you need to use syntax: raise exception ''Member % Not Found'', unitno; > -Original Message- > From: Gary Stainburn [SMTP:[EMAIL PROTECTED]] > Sent: Wednesday, July 18, 2001 10:24 AM > To: pgsql-sql > Subject: Re: pl/pgsql - code review + question > > Okay, I've been hit r

[SQL] Re: pl/pgsql - code review + question

2001-07-18 Thread Gary Stainburn
Hi Jeff, That's sorted my exceptions out, now all I've got to do is find out why it's not finding the record in the first place. Gary. On Wednesday 18 July 2001 4:48 pm, Jeff Eckermann wrote: > I think you need to use syntax: > raise exception ''Member % Not Found'', unitno; > > > -Origin

Re: [SQL] pl/pgsql - code review + question

2001-07-18 Thread Gary Stainburn
Okay, I've been hit round the back of the head, and I realised that the postgresql functions (inc subtring) are available in pl/pgsql, so that's my problem solved. I've written the getmid function as below, which is basically the same as the getunitno I included in my first post. My problem n

[SQL] pl/pgsql - code review + question

2001-07-18 Thread Gary Stainburn
Hi all, I've just written my first pl/pgsql function (code included below for you to pull apart). It takes an int4 mid (e.g. 15) and then using a select pulls out the team number (e.g. 'NE/012' and a unit number (e.g. 2) and returns the full unit number NE/012-02. I now want to write the reve

Re: [SQL] SPI_exec does not return!

2001-07-18 Thread Jan Wieck
Markus Wagner wrote: > Hi, > > if I do a SELECT on a non-existing table, SPI_exec won't return. > I get, e. g. in pgaccess, an error message " does not exist", > and my code below the function call is never reached. Right, the SPI_exec() call in turn calls the PostgreSQL parser and

Re: [SQL] CAST(ipaddress as text) -- HOW?

2001-07-18 Thread Bhuvan A
hi, ipaddress::text is resulting in ERROR: Cannot cast type 'cidr' to 'text' how else we can??? Thankx. On Tue, 17 Jul 2001, omid omoomi wrote: > ie, > ipaddrss::text > > >From: Bhuvan A <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: [SQL] CAST(ipaddress as text) -- HOW? >

[SQL] SPI_exec does not return!

2001-07-18 Thread Markus Wagner
Hi, if I do a SELECT on a non-existing table, SPI_exec won't return. I get, e. g. in pgaccess, an error message " does not exist", and my code below the function call is never reached. So why return error codes for SPI_exec when you cannot evaluate them? The background: I need to distinguish d