On Fri, Apr 3, 2009 at 11:28 PM, John DeSoi wrote:
>> Is there any way to use PL/pgSQL code outside of a function?
>
> No.
I kinda figured, but it doesn't hurt to ask.
>> The reason I'm asking is that I'm porting some code from
>> sybase/isql/SQR, and it allows some control code structures to be
On Apr 3, 2009, at 5:03 PM, Peter Koczan wrote:
Is there any way to use PL/pgSQL code outside of a function?
No.
The reason I'm asking is that I'm porting some code from
sybase/isql/SQR, and it allows some control code structures to be used
in an sql script. For instance,
CASE might wor
--- On Mon, 9/8/08, Ruben Gouveia <[EMAIL PROTECTED]> wrote:
> From: Ruben Gouveia <[EMAIL PROTECTED]>
> Subject: [SQL] PL/pgSQL function syntax question?
> To: "pgsql-sql"
> Date: Monday, September 8, 2008, 9:40 PM
> i get the following error when i try and create the
> following function:
>
I see v_dt is not initialized before comparison, there should be some value
in it before it is useful.
--Imad
On Tue, Sep 9, 2008 at 8:47 AM, Adrian Klaver <[EMAIL PROTECTED]> wrote:
>
> -- Original message --
> From: "Ruben Gouveia" <[EMAIL PROTECTED]>
> > i get
-- Original message --
From: "Ruben Gouveia" <[EMAIL PROTECTED]>
> i get the following error when i try and create the following function:
>
> Basically, i am trying to have two different dates compared and only the
> most recent returned to me. This seems pretty
Martin Edlman wrote:
> |> I don't want to rewrite whole trigger to plPerl as I would have to use
> |> DBD-PgSPI.
> |
> | Huh? Certainly not -- there are functions in PL/Perl for this. See
> | spi_exec_query in
> | http://www.postgresql.org/docs/8.3/static/plperl-database.html
>
> Oh, I see. I ha
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
|> I don't want to rewrite whole trigger to plPerl as I would have to use
|> DBD-PgSPI.
|
| Huh? Certainly not -- there are functions in PL/Perl for this. See
| spi_exec_query in
| http://www.postgresql.org/docs/8.3/static/plperl-database.html
Oh,
Martin Edlman wrote:
> I don't want to rewrite whole trigger to plPerl as I would have to use
> DBD-PgSPI.
Huh? Certainly not -- there are functions in PL/Perl for this. See
spi_exec_query in
http://www.postgresql.org/docs/8.3/static/plperl-database.html
--
Alvaro Herrera
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello,
| no, it's not possible in plpgsql. Please, use plperl or plpython.
thanks for the response. It's as I expected and was afraid of :-(
I select data from DB using pl/PgSQL in the replace_values trigger and
then call plPerl function which retu
Hello
no, it's not possible in plpgsql. Please, use plperl or plpython.
Regards
Pavel Stehule
On 07/04/2008, Martin Edlman <[EMAIL PROTECTED]> wrote:
> Hello,
>
> is it possible to use variables as field names in the NEW record?
> Let's suppose I have a varchar attname containg the name
www.postgresql.org/docs/8.2/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
would be the place to look.
>>> Alex Hochberger <[EMAIL PROTECTED]> 2008-02-29 6:29 >>>
I do not know. It's sounds like the Oracle PL/SQL behavior is what I
want. Does PostgreSQL's pl/pgsql have such a f
I do not know. It's sounds like the Oracle PL/SQL behavior is what I
want. Does PostgreSQL's pl/pgsql have such a feature? It's not in
the documentation anywhere. I'll check it from the office tomorrow.
Alex
On Feb 28, 2008, at 11:43 PM, Tom Lane wrote:
Alex Hochberger <[EMAIL PROTECTE
Alex Hochberger <[EMAIL PROTECTED]> writes:
> Is it possible to grab access to the actually user-friendly error
> message?
Doesn't the SQLERRM variable do what you want?
regards, tom lane
---(end of broadcast)---
TIP 4: Ha
Sebastian Ritter написа:
Hi all,
I have a question regarding functions. How can I return zero rows from a
function whose return type is a table row? I did the following test and it
did not work as expected:
[...]
CREATE OR REPLACE FUNCTION foobar(boolean) RETURNS SETOF x AS $_$
DECLARE
Hello
it has sense only for array type
so you can try:
create replace function foo(anyarray)
returns bool as $$
begin
return (select 1 = any($1));
end ; $$ language plpgsql;
postgres=# select foo(array[1,2,3]);
foo
-
t
(1 row)
postgres=# select foo(array[2,3]);
foo
-
f
(1 row)
R
On 5/11/07, Robins <[EMAIL PROTECTED]> wrote:
Hi Gabriel,
There are two ways to do this:
1. Imad's way (Define the function with the return type as RECORD). Its only
problem is that while querying from this function, you need to give a proper
SELECT query or else PG returns an error.
Yeah ...
Hi Gabriel,
There are two ways to do this:
1. Imad's way (Define the function with the return type as RECORD). Its only
problem is that while querying from this function, you need to give a proper
SELECT query or else PG returns an error.
e.g. As Imad gives in his example ...
CREATE FUNCTION x
create a function with return type as a RECORD.
CREATE FUNCTION xyz() RETURNS record AS
$$
declare
abc RECORD;
begin
abc := (1, 2);
return abc;
end;
$$
language plpgsql;
And execute the function in this fashion:
select a, b from xyz() as (a int, b int);
Do you like that ... :-)
--Imad
www
You can use CREATE TYPE:
http://www.postgresql.org/docs/8.2/interactive/sql-createtype.html
Example from the documentation:
CREATE TYPE compfoo AS (f1 int, f2 text);
Then make your function return compfoo (or setof compfoo).
Alternately, you can define your function with out or in/out
par
On Fri, 11 May 2007 19:09:07 +0500
imad <[EMAIL PROTECTED]> wrote:
> You might be looking for PostgreSQL RECORD data type.
Thanks. Give me an example please. I saw the documentation already.
>
> --Imad
> www.EnterpriseDB.com
>
> On 5/11/07, Gábriel Ákos <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
>
You might be looking for PostgreSQL RECORD data type.
--Imad
www.EnterpriseDB.com
On 5/11/07, Gábriel Ákos <[EMAIL PROTECTED]> wrote:
Hi,
How should I define a record type (there is no table with this record
type) programmatically in pl/pgsql?
I'd like to return a record with 3 string elements
sneumann wrote:
Hi,
I have a PL/pgsql function that creates a certain bit string
based on the parameters. Things work fine if I use bit(10)
throughout the function. Now I'd like to return a bit string
with the given size "len", but that breaks with a syntax error:
ret := B'0'::bit(len
Thanks,
The search path was the problem. Sometimes it's the simple things.
Big thanks,
J
---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster
Tom Lane wrote:
PostgreSQL Admin <[EMAIL PROTECTED]> writes:
CREATE OR REPLACE FUNCTION insert_staff_b
(insert_firstname varchar)
RETURNS VOID AS
...
Still I get this error:
Warning: pg_query(): Query failed: ERROR: function
insert_staff_b(character varying) does not exist
Sure lo
PostgreSQL Admin <[EMAIL PROTECTED]> writes:
> CREATE OR REPLACE FUNCTION insert_staff_b
> (insert_firstname varchar)
> RETURNS VOID AS
> ...
> Still I get this error:
> Warning: pg_query(): Query failed: ERROR: function
> insert_staff_b(character varying) does not exist
Sure looks like it ou
Scott Yohonn wrote:
> Jean-Paul,
>
> Thanks! This did work. The output put the name of the function
> (get_table_count) as the header. How would I display the name of the table
> that I am requesting the row count of?
The only way I know is to alias the output in the query calling the
function, s
On 5/14/06, Scott Yohonn <[EMAIL PROTECTED]> wrote:
Using PL/PGSQL, I am trying to create a procedure to display the
count of rows in any single table of a database. The End-user would
pass in a table name and the prodecure would display the table name
with the row count.
I am able to hardcode t
Hi Scott,
You'll have to execute dynamic SQL (see doc chapter "36.6.5. Executing
Dynamic Commands") for your function to work:
CREATE FUNCTION get_table_count(tablename text) RETURNS integer AS
$$
DECLARE
--tablename ALIAS FOR $1;
rowcount INTEGER;
BEGIN
execute 'SELECT count(*) F
On Fri, Aug 19, 2005 at 02:38:01AM -0300, Marc G. Fournier wrote:
> I have an older PostgreSQL book here, that has chapter on pl/PgSQL in it,
> but no good samples
>
> What I'm looking for is a sample of a function that returns # of rows
> updated, so that I can make a decision based on tha
MGF> I have an older PostgreSQL book here, that has chapter on pl/PgSQL in it,
MGF> but no good samples
MGF> What I'm looking for is a sample of a function that returns # of rows
MGF> updated, so that I can make a decision based on that ... does anyone know
MGF> where I could find such (a
Yep.. i have solved this problem by specifying
the correct return type and variable type (should be the same)
but as said, in some cases pl_exec executes with type conversion.
as real example - i have :
return type = SETOF new type "category_node(catid, pcatid)"
variable = R, SR -> RECORD
and
FOR
On Mar 11, 2005, at 5:54 AM, Juris Zeltins wrote:
FOR P IN select pageid from pages
This way you are only getting the pageid column. I think what you want
is
FOR P in select * from pages
so that P contains the complete pages record.
John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreS
On Thu, 3 Feb 2005 12:48:11 -0400 (AST), Marc G. Fournier
<[EMAIL PROTECTED]> wrote:
Perfect, worked like a charm ... but the RETURNS still needs to be a
SETOF, other then that, I'm 'away to the races' ... thanks :)
No SETOF necessary :
CREATE TYPE mytype AS ( number INTEGER, blah TEXT );
Perfect, worked like a charm ... but the RETURNS still needs to be a
SETOF, other then that, I'm 'away to the races' ... thanks :)
On Wed, 2 Feb 2005, George Weaver wrote:
Hi Marc,
One option is to create a simple data type and return the rowtype of the
datatype
eg CREATE TYPE tserverload AS ("
Hi Marc,
One option is to create a simple data type and return the rowtype of the
datatype
eg CREATE TYPE tserverload AS ("server_name" text, "load_avg" int4);
CREATE FUNCTION getserverload()
RETURNS tserverload
AS
'DECLARE
r tserverload%rowtype;
etc.
You would then return r, comprise
Ð ÐÑÑ, 12.10.2004, Ð 15:24, Markus Bertheau ÐÐÑÐÑ:
> Is the order of the rows guaranteed to be preserved?
Neil clarified on IRC that
- there is no interface guarantee
- in the current implementation the order is preserved
- a future implementation is likely to change that
Thanks.
--
Markus Ber
Sergio Fantinel wrote:
I found how to use, inside a PL/pgSQL function, a two-dimensions array
(matrix).
There is a limitation: the number of the 'columns' of the matrix is
fixed at declaration time (in DECLARE section) and you need to manually
initialize all the elements in the first 'row' of th
the inquirer wrote:
I am trying to create a function that creates a user
and adds a row to a table. It produces no warnings or
errors when I create the function but when I attempt
to execute it I get a syntax error. I do not
understand why this is happening. Any help would be
greatly appreciate
Hello,
I have an instance where I have a series of pl/pgsql calls, that report stat
results to a common table. When other queries try to hit the stat table
(with DML commands; SELECT, INSERT, UPDATE, DELETE etc.) they are forced to
wait in a queue until the pl/pgsql has finished executing.
On Sat, Oct 11, 2003 at 10:36:10AM +0100, Richard Huxton wrote:
>
> Oh - while I'm thinking of it, a couple of applications it might be worth
> looking at are OpenACS or Bricolage, both web-based content-management
> systems.
OpenACS is not a content management system, but it provides a couple
On Saturday 11 October 2003 08:57, Muhyiddin A.M Hayat wrote:
> Where can i find a complete full terminated database schema in SQL?
>
> I want to see a real complete database schema with views, triggers..
> etc,...
Oh - while I'm thinking of it, a couple of applications it might be worth
looking
On Saturday 11 October 2003 08:57, Muhyiddin A.M Hayat wrote:
> Where can i find a complete full terminated database schema in SQL?
>
> I want to see a real complete database schema with views, triggers..
> etc,...
Good places to start are:
http://freshmeat.net/
http://sourceforge.net/
That's
Tomasz Myrta <[EMAIL PROTECTED]> writes:
> Do you know anything about good source of C functions documentation and
> examples?
Look in the main sources (backend/utils/adt/, mostly) and/or contrib
modules for functions that do something like what you need. The only
difference between a builtin fu
I don't understand ERROR message at all:
ERROR: SPI_prepare() failed on "SELECT $1 "
> This is a bug. Or two bugs, actually: one of yours and one of PG's.
I have repaired the PG bug with the attached patch. The bug in your
code is that your C function needs to call SPI_connect and SPI_fin
Tomasz Myrta <[EMAIL PROTECTED]> writes:
> I don't understand ERROR message at all:
> ERROR: SPI_prepare() failed on "SELECT $1 "
This is a bug. Or two bugs, actually: one of yours and one of PG's.
I have repaired the PG bug with the attached patch. The bug in your
code is that your C func
Thanks Rajesh. It 's very useful reference site.
Jack
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing lis
Stephan ,
Both of two suggestion work. Thank you very much!
Jack
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
Folks,
One more note on the PostgreSQL SQL highlighting mode for Kate:
Shane Wright, the author, has asked for feedback. So if you use it, please
send feedback and requests to me and I'll forward them.
--
-Josh Berkus
Aglio Database Solutions
San Francisco
---(end o
Folks,
> > Well, Shane Wright just wrote an PostgreSQL syntax highlighter for Kate
(part
> > of the KDE project) Unfortunately, it's part of KDE 3.1, so if you're
using a
> > packaged distribution you'll have to wait for the next distribution
version.
Actually, Shane just sent me the XML fil
I use Editplus (http://www.editplus.com/) with PosgreSQL syntax highlighting
(ftp://ftp.editplus.com/files/postgre.zip). I also define psql as external
tool in Editplus and use shortcut (Ctrl + 1) to send file to server.
Tambet
- Original Message -
From: "Eduardo" <[EMAIL PROTECTED]>
To
Eduardo,
> Do exists a PL/PGSQL editor?
Not that I know of. We've talked about this for PGAccess, but nothing's come
of it because nobody has the motivation to code it, yet. PGAccess does have a
function editor, but it's rather limited.
I've been told that TOra (http://www.globecom.se/tora/)
You can try Crimson Editor, a free powerful editor.
http://www.crimsoneditor.com/
Regards Frankie
"Eduardo" <[EMAIL PROTECTED]> wrote in message news:b2h2b0$uqd$[EMAIL PROTECTED]...
> Do exists a PL/PGSQL editor?
>
> Thanks.
>
>
>
---(end of broadcast)-
Jim,
> Yes i'm aware this it is possible in 7.3 - can someone please confirm its
> not possible in 7.2 or provide me with an example of how to go about it.
It is sort of possible in 7.2, as a function can return a cursor to an
interface language capable of handling cursors. However, implementa
Josh Berkus wrote:
Tim,
That loop apparently does not find any matching rows, which would
have been inserted just before this row was, inside the same
transaction.
It was successfully finding those rows before, when the trigger was
AFTER INSERT. If I manually select those rows after the query
Tim,
> That loop apparently does not find any matching rows, which would
> have been inserted just before this row was, inside the same
> transaction.
>
> It was successfully finding those rows before, when the trigger was
> AFTER INSERT. If I manually select those rows after the query is
> commi
Ludwig Lim wrote:
Try changing the "AFTER" to "BEFORE"
CREATE TRIGGER projtask_insert_depend_trig BEFORE...
Changes made to the "NEW" will not be reflect in the
AFTER trigger since, the row is already inserted.
Thanks, however this seems to present a different problem now.
FOR depe
--- Tim Perdue <[EMAIL PROTECTED]> wrote:
> I have created a function in pl/pgsql to modify a
> row before it gets put
> into the database, but it seems my modification is
> being ignored, and
> the unmodified row is being inserted.
>
> I have confirmed with this RAISE EXCEPTION that my
> "NEW"
Tim Perdue <[EMAIL PROTECTED]> writes:
> I have created a function in pl/pgsql to modify a row before it gets put
^^^
> into the database, but it seems my modification is being ignored, and
> the unmodified row is being inserted.
> CREAT
On Wednesday 25 September 2002 21:38, Gustavo Tadao Okida wrote:
(...)
> After this, I wrote a function with
> pgaccess :
>
> Name: spi_novo_parametro paramters:
> returns: char language: plpgsql
>
> DECLARE
> val INTEGER :=1;
> BEGIN
> insert into
On Tue, Jul 02, 2002 at 01:37:08AM +0200, Ferenc Engard wrote:
>
> If I understand well, I can create a cursor for a SELECT statement, and
> return that cursor. Well, it is better than nothing, but I fear it is
> not flexible enogh for me.
Maybe not for the solution you have right now, but you m
> > since it changed: can I use the procedural languages (any of them) to
> > return a table- (or view-) like output, just like in Interbase, for
> > example? E.g., if I have a metamodel and I want to write functions what
> > perform complex computations and queries, can they return the result
> >
On Mon, Jul 01, 2002 at 01:43:29AM +0200, Ferenc Engard wrote:
> Hi all,
>
> A long time ago (at version 6.3.2 or what :) I have asked, but maybe
> since it changed: can I use the procedural languages (any of them) to
> return a table- (or view-) like output, just like in Interbase, for
> example
I've sorted this one thanks to John Berkus.
Thanks guys. I've included the solution below
for your interest.
===
DROP TABLE rtest;
DROP INDEX rtest_xz_index;
DROP INDEX rtest_yz_index;
DROP INDEX rtest_xy_index;
CREATE TABLE rtest (
On Thu, Nov 01, 2001 at 04:48:29PM +, Edward Grabczewski wrote:
>
> DROP FUNCTION threedpoint (float,float,float, float,float,float);
> CREATE FUNCTION threedpoint (float,float,float,float,float,float)
> RETURNS text
> AS 'DECLARE
> x1 ALIAS FOR $1;
> y1 ALIAS FOR $2;
> z1 A
From [EMAIL PROTECTED] Tue Oct 23 18:33:27 2001
Content-Disposition: inline
From: "Aasmund Midttun Godal" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [SQL] PL/pgSQL triggers ON INSERT OR UPDATE
First, I may be wrong but I do think they would prefer if you did not cross-post
(especially to hackers).
Second I think it probably make more sense to make two different triggers here.
If you really wanted to do it that way you might want to try executing that part.
Regards,
Aasmund.
On Mon
Humm... 7.0.2, I'll upgrade and try again.
Thanks!
Tom Lane wrote:
[EMAIL PROTECTED]">rdear <[EMAIL PROTECTED]> writes:
I'm doing a check within a PL/PGSQL function using a regular expression and I get the error:
ERROR: regcomp failed with error invalid character range
This appears
rdear <[EMAIL PROTECTED]> writes:
> I'm doing a check within a PL/PGSQL function using a regular expression
> and I get the error:
> ERROR: regcomp failed with error invalid character range
> This appears to be because of the underscore "_" character. The regex I
> want to use is ''[A-Za-z0-9
> Josh - if I try and do OFFSET at the same time (presumably it's the same
> change) do you fancy acting as a sanity test site?
>
Both LIMIT and OFFSET seem to have that restriction. I will add this to
the TODO list.
--
Bruce Momjian| http://candle.pha.pa.us
[EMAI
Richard,
> > Josh - if I try and do OFFSET at the same time (presumably it's the
> same
> > change) do you fancy acting as a sanity test site?
>
> What am I talking about - OFFSET is going to be parsed by the SQL
> parser not
> the plpgsql parser.
Not so, not so!
Try the following two PL/pgSQL
From: "Richard Huxton" <[EMAIL PROTECTED]>
> False Laziness perhaps (spot my Perl background)
>
> OK - stick me down for having a look at it. Had a quick peek and I think
> it's within my abilities. Give me a couple of weeks, because I haven't
> looked at a YACC file since my university days (gra
From: "Tom Lane" <[EMAIL PROTECTED]>
> "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
> would
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
"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
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
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
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
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
Crhis,
> Thanks ;). I'm new to PostGreSQL and to PHP and to SQL - I have done
> Progress RDBMS/4GL for the last 12 years and it absolutely spoils
> you. But
> in the last 2 weeks, I have hammered out an application (you can have
> a look
> at http://chill-025.bbnow.net, use user demo and password
Hi Josh,
on 07/17/2001 18:31, Josh Berkus at [EMAIL PROTECTED] wrote:
> Chris,
>
> Hmmph. People are in a bad mood this week; obviously few other people
> on the list have had to write applications for the banking industry,
> which trades everything in flat files. Give Chris a break!
>
Than
Chris,
Hmmph. People are in a bad mood this week; obviously few other people
on the list have had to write applications for the banking industry,
which trades everything in flat files. Give Chris a break!
> >From an input file where the records looks like this one:
>
> 020-13 016-05 07-15-200
Chris Ruprecht <[EMAIL PROTECTED]> writes:
> If life was easy, everything would just come in the format I'd like it. But
> since it isn't, I need to create records like this one:
> ...
> From an input file where the records looks like this one:
If it's just a data import issue, why do you want to
Hi Tom,
If life was easy, everything would just come in the format I'd like it. But
since it isn't, I need to create records like this one:
cdate| ctime | countrycode | areacodex | success | carrier |
duration| phonenumber | areacode | pseq | loadno | frline | entity |
loaddate | loa
Chris Ruprecht writes:
> I need to know how I can access a flat file from within a PL/PGSQL script.
You can't.
PL/TclU could help you there.
--
Peter Eisentraut [EMAIL PROTECTED] http://funkturm.homeip.net/~peter
---(end of broadcast)---
T
"Chris Ruprecht" <[EMAIL PROTECTED]> writes:
> I need to know how I can access a flat file from within a PL/PGSQL script.
You can't --- and you should ask yourself hard questions about why your
system design needs that, or whether the data in question shouldn't be
inside the database to begin wit
You can probably try to make a c extension that does open/close.
On 17 Jul 2001 15:28:36 -0500, Chris Ruprecht wrote:
> Hi all,
>
> I need to know how I can access a flat file from within a PL/PGSQL script.
> I have an Oracle PL/SQL book here and they refer to FOPEN(...), FCLOSE(...)
> but these
The hack and slash Perl programmer in me says---
if you only plan to do this once, (like importing data), then
just write a Perl script that *generates* SQL code that does
your inserts, updates, or whatever. You can then execute
thsi with psql -f filename. But if you're trying to use
flat files pr
On Tue, Jun 05, 2001 at 08:18:03AM +0200, Andrzej Roszkowski wrote:
> Hi!
> I can't find any info about possible data types that can be returned from
> procedure. I want to return tuple. When I use OPAQUE as a return type I
> get error message that OPAQUE can be only returned from trigger. It is
>
From: "wade" <[EMAIL PROTECTED]>
> create function get_details(int4) returns details as '
> declare
> ret details%ROWTYPE;
> site_recrecord;
> cntct contacts%ROWTYPE;
> begin
> select into site_rec * sites_table where id = $1 limit 1;
> select into cntct * from contacts where
Josh Berkus wrote:
> This brings up an important point. We have a medium-large user base for
> PL/pgSQL out there, but it appears that Jan Wieck no longer has time to
> develop the language ... nor should he be the sole developer. Howe do
> we find more developers to expand & extend PL/pgSQL? I
Jie Liang wrote:
>
> I think that is a bug in plpgsql,
> when passing a NULL into a plpgsql defined function, it treats
> other arguments as NULL also, you can use raise notice in
> your function to watch this buggy thing(see following).
You're blaming the wrong code for it. It's an insuffi
> I'm happy to do my bit on the documentation side, but I don't want to end
> up duplicating the cookbook - does anyone know the status of this? I'd
> guess 90% of plpgsql functions will be on the same "theme" as something
> in a cookbook so it's the perfect format for learning/cut & paste.
I
On 3/14/01, 4:28:03 PM, Josh Berkus <[EMAIL PROTECTED]> wrote regarding Re:
[SQL] PL/pgSQL "compilation error":
> Tim,
> > Hello all - I apologize for the newbie-esque question, but the debug
output
> > from postgres when you have a bug in your PL/pgSQL pr
Bruce Momjian writes:
> There is a PL/PgSQL HowTo that we are trying to integrate into the docs
> for 7.1. Anyone have a URL or status on that?
It's not a PL/pgSQL Howto, it's just a documentation how to port from
Oracle's PL/SQL. The status is "done". The author expressed interest in
more wo
> Bruce Momjian writes:
>
> > There is a PL/PgSQL HowTo that we are trying to integrate into the docs
> > for 7.1. Anyone have a URL or status on that?
>
> It's not a PL/pgSQL Howto, it's just a documentation how to port from
> Oracle's PL/SQL. The status is "done". The author expressed inter
From: "Tim Perdue" <[EMAIL PROTECTED]>
> Hello all - I apologize for the newbie-esque question, but the debug
output
> from postgres when you have a bug in your PL/pgSQL procedure is none to
> detailed.
>
> I've created the following procedure and am getting an error when I try to
> update the ta
> IF NEW.status_id <> OLD.status_id THEN
> IF new.status_id = 1 THEN
> UPDATE artifact_counts_agg SET open_count=open_count+1 \
>WHERE group_artifact_id=new.group_artifact_id;
> ELSE IF new.status_id = 2 THEN
> UPDATE artifact_counts_
Tim,
> Hello all - I apologize for the newbie-esque question, but the debug output
> from postgres when you have a bug in your PL/pgSQL procedure is none to
> detailed.
It's an improvement over the query parser errors -- at least in
PL/pgSQL you get a line number! Although in your case, the l
On Wed, Mar 14, 2001 at 10:33:49AM -0500, Bruce Momjian wrote:
> It is hard to test this without the table schema, but I think you are
> missing some END IF's in the code above. Those are not elif's, but
> actual new IF's that need their own END IF, I think.
Oh wow - this is almost like going ba
Don't you have one END IF too many?
regards, tom lane
---(end of broadcast)---
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl
1 - 100 of 131 matches
Mail list logo