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
Hi all,
Is there any way to use PL/pgSQL code outside of a function?
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,
begin
if ((select count(*) from users where login = 'foo') = 0)
--- 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 tr
t
> or
> > near "loop"
> > SQL state: 42601
> > Character: 195
>
> You need to DECLARE v_record as a RECORD variable.
> v_record RECORD;
>
> --
> Adrian Klaver
> [EMAIL PROTECTED]
>
>
>
>
>
> -- Forwarded message --
-- 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
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 straight forward, what I am
doing wrong here?
create or replace function fcn_pick_date(v_dt date)
returns
Tom Lane wrote:
> "Joshua D. Drake" <[EMAIL PROTECTED]> writes:
> > From what I can see on CPAN (unless I am missing something) DBD::PgSPI
> > hasn't been updated since 2004 and is at version 0.2.
>
> Oh, if it's not a live project then that changes things entirely.
> +1 for just dropping the ment
"Joshua D. Drake" <[EMAIL PROTECTED]> writes:
> From what I can see on CPAN (unless I am missing something) DBD::PgSPI
> hasn't been updated since 2004 and is at version 0.2.
Oh, if it's not a live project then that changes things entirely.
+1 for just dropping the mention.
Alvaro Herrera <[EMAIL PROTECTED]> writes:
> Question for plperl hackers: Should we remove the mention of DBD::PgSPI
> from the PL/Perl manual?
It seems like a reasonable suggestion to me, since perl database users
probably already know DBD and don't have to learn something new if they
go that wa
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
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 of the field and I want
to know a value that field of the NEW record.
Problem is that I get an error 'record "new" has no field "attname"'. Of
course I want to u
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
Is it possible to grab access to the actually user-friendly error
message? I have a bunch of files that come into my database, each
slightly different. The submitter fills out a form that records the
info, and sticks it into a table.
If the file is malformed (wrong number of columns in a
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
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
fn_get_user (integer) RETURNS usertable AS '
DECLARE
in_userid A
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
Hello list,
I'm trying to write a function that uses one of its arguments as
an input to an IN operator in a WHERE clause. I.e., something like:
-- ids are actually integers
CREATE FUNCTION foo(ids SOMETYPE) RETURNS [whatever] AS $$
BEGIN
SELECT id, [other stuff] FROM table WHERE [other cond
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
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, 2 integers and 1
date.
Rgds,
Akos
--
Üdvözlettel,
Gábriel Ákos
-=E-Mail :[EMAIL PROTECTED]|Web: http://www.i-logic.hu =-
-=Tel/fax
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
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);
LINE 1:
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
I'm having this problem inserting data from my form using PL/pgSQL.
Here is the simplified version of my table and function (this example
does not work, also ):
CREATE TABLE theirry.sample (
staff_id serial PRIMARY KEY NOT NULL,
firstname varchar(100),
lastname varchar(150),
usern
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
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 the variable for table and get the appropriate results
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
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 that ... does anyone know
where I could find such (and others, would be gre
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
Hello!
i have problem with pl/pgsql function;
===
ERROR: wrong record type supplied in RETURN NEXT
CONTEXT: PL/pgSQL function "tests" line 6 at return next
===
-- Function: tests(int8)
-- DROP FUNCTION tests(int8);
CREATE OR REPLACE FUNCTION te
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 );
uot;Marc G. Fournier"
<[EMAIL PROTECTED]>
To:
Sent: Wednesday, February 02, 2005 3:10 PM
Subject: [SQL] PL/PgSQL - returning multiple columns ...
I have a function that I want to return 'server_name, avg(load_avg)' ... if
I wanted to return matching rows in a table, I ca
.
You would then return r, comprised of r.server_name and r.load_avg.
George
- Original Message -
From: "Marc G. Fournier" <[EMAIL PROTECTED]>
To:
Sent: Wednesday, February 02, 2005 3:10 PM
Subject: [SQL] PL/PgSQL - returning multiple columns ...
I have a function that I
I have a function that I want to return 'server_name, avg(load_avg)' ...
if I wanted to return matching rows in a table, I can do a 'setof
', with a for loop inside ... but what do I set the 'RETURNS' to if
I want to return the results of query that returns only two fields of a
table, or, in th
Ð ÐÑÑ, 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
Hi,
When I call a PL/pgSQL function that looks roughly like the following:
...
FOR x IN SELECT ... ORDER BY ... LOOP
RETURN NEXT x;
END LOOP;
RETURN;
END;
Is the order of the rows guaranteed to be preserved?
Thanks.
--
Markus Bertheau <[EMAIL PROTECTED]>
---(
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
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 the matrix.
The number of
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
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 appreciated.
SELECT create_aut
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
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,...
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
Hi
I'm making my first steps in C functions. I want to avoid doing all the
SQL job in them, pl/pgsql looks a better choice. I tried to do this by
passing opened cursor from pl/pgsql function to C function.
Here is simple C function:
#include
#include
PG_FUNCTION_INFO_V1(test2);
Datum test2(PG_
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
AIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 13, 2003 11:20 PM
Subject: [SQL] PL/PGSQL EDITOR
> Do exists a PL/PGSQL editor?
>
> Thanks.
>
>
>
>
> ---(end of broadcast)---
> TIP 1: subscrib
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)-
This is suppose to pull all the columns of the table
that initiated the trigger func from the sys catalogs, loop through them and put
everything that has changed between OLD and NEW into a comma delimited string
for input into a log like table for future analysis via middleware
(php,perl.
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
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" row is modified
properly, however it is not being stored
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
Hi,
I'm a new PostgreSql user but I have some experience in Oracle. So I
decided to use PL/pgsql to build my procedure (functions).
I create an database called MyDatabase and add this language into it
with: createlang plpgsql MyDatabase. After this, I wrote a function with
pgaccess :
Nam
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
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? E.g., if I have a metamodel and I want to write functions what
perform co
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
Could someone please tell me the correct syntax for the following problem in
plpgsql:
The following expression code sample works but now (for example) I'd like to
subsitute
the variables $1 and $2 for the numbers 0 and 2 in the following
expression:
INSERT INTO rtest(xz,yz,xy)
VALUES ( \'(0,2),
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
Hello, I'm trying to set up a trigger on insert or update
but when using the predefined variable ``OLD'' I get a
NOTICE from the trigger function about OLD not being defined yet.
Of course OLD is not defined when the function is triggered on INSERT
event, and I did not mention it if not inside a
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
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_]'' but this doesn't work. Any suggestions
> 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
1 - 100 of 184 matches
Mail list logo