pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
trigger problem!
5+ messages / 5 participants
[nested] [flat]

* trigger problem!
@ 2001-03-17 05:19 jreniz <jreniz@tutopia.com>
  2001-03-18 20:40 ` Re: trigger problem! Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 1 reply; 5+ messages in thread

From: jreniz @ 2001-03-17 05:19 UTC (permalink / raw)
  To: pgsql-admin

Hi friends!

I'm working in a trigger and I need to put the result
of a query into a variable.

That's very easy- apparently!

The query has a aggregate function like this:

select sum(field) into variable ...

and I'm sure that field and variable are int4 type.

So, when I run this trigger there is a mistake:
 ''there is no operator '=$' for types 'int4' and 'int4'
   you will either have to retype this query using an
   explicit cast, or you will have to define the operator
   using CREATE OPERATOR''

what's meaning this? and
how can I assign the result of aggregate function into a
variable?
(My system is 6.5.3)






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: trigger problem!
  2001-03-17 05:19 trigger problem! jreniz <jreniz@tutopia.com>
@ 2001-03-18 20:40 ` Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 5+ messages in thread

From: Peter Eisentraut @ 2001-03-18 20:40 UTC (permalink / raw)
  To: jreniz <jreniz@tutopia.com>; +Cc: pgsql-admin

jreniz writes:

>  ''there is no operator '=$' for types 'int4' and 'int4'

It seems you need to put a space into a construct of the sort 'x = $1'.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Trigger problem
@ 2002-05-03 11:17 jquest jquest <jquest_j@hotmail.com>
  2002-05-03 15:57 ` Re: Trigger problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
  2002-05-05 22:29 ` Re: Trigger problem Aaron Spiteri <aaron@m1group.com.au>
  0 siblings, 2 replies; 5+ messages in thread

From: jquest jquest @ 2002-05-03 11:17 UTC (permalink / raw)
  To: pgsql-admin

Hi,
I am new to postgresql and to this moment I am using oracle.
I use posgresql 7.1.2

I try to create very simple ( from doc. examples ) trigger:

CREATE FUNCTION add_one (integer) RETURNS INTEGER AS '
    BEGIN
        RETURN $1 + 1;
    END;
' LANGUAGE 'pgsql';

But the system report:
ERROR:  Unrecognized language specified in a CREATE FUNCTION: 'pgsql'.
	Recognized languages are sql, C, internal, and created procedural 
languages.

I readet in documentation that pgsql is good solution for SP.

Where is the problem?

Many thanks in advance.

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Trigger problem
  2002-05-03 11:17 Trigger problem jquest jquest <jquest_j@hotmail.com>
@ 2002-05-03 15:57 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Stephan Szabo @ 2002-05-03 15:57 UTC (permalink / raw)
  To: jquest jquest <jquest_j@hotmail.com>; +Cc: pgsql-admin

On Fri, 3 May 2002, jquest jquest wrote:

> Hi,
> I am new to postgresql and to this moment I am using oracle.
> I use posgresql 7.1.2
>
> I try to create very simple ( from doc. examples ) trigger:
>
> CREATE FUNCTION add_one (integer) RETURNS INTEGER AS '
>     BEGIN
>         RETURN $1 + 1;
>     END;
> ' LANGUAGE 'pgsql';
>
> But the system report:
> ERROR:  Unrecognized language specified in a CREATE FUNCTION: 'pgsql'.
> 	Recognized languages are sql, C, internal, and created procedural
> languages.
>
> I readet in documentation that pgsql is good solution for SP.
>
> Where is the problem?

You'll want to use 'plpgsql' which is the full name of the procedural
language.  If it still fails, it means that createlang was not used on
the database, and you'll want to issue a
createlang plpgsql <database>
as the postgres user from a shell.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Trigger problem
  2002-05-03 11:17 Trigger problem jquest jquest <jquest_j@hotmail.com>
@ 2002-05-05 22:29 ` Aaron Spiteri <aaron@m1group.com.au>
  1 sibling, 0 replies; 5+ messages in thread

From: Aaron Spiteri @ 2002-05-05 22:29 UTC (permalink / raw)
  To: jquest jquest <jquest_j@hotmail.com>; pgsql-admin

In postgres you the plsql equivalent is 'plpgsql' not 'plsql'.

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 3/05/02, 21:17:38, "jquest jquest" <jquest_j@hotmail.com> wrote 
regarding [ADMIN] Trigger problem:


> Hi,
> I am new to postgresql and to this moment I am using oracle.
> I use posgresql 7.1.2

> I try to create very simple ( from doc. examples ) trigger:

> CREATE FUNCTION add_one (integer) RETURNS INTEGER AS '
>     BEGIN
>         RETURN $1 + 1;
>     END;
> ' LANGUAGE 'pgsql';

> But the system report:
> ERROR:  Unrecognized language specified in a CREATE FUNCTION: 'pgsql'.
>       Recognized languages are sql, C, internal, and created procedural
> languages.

> I readet in documentation that pgsql is good solution for SP.

> Where is the problem?

> Many thanks in advance.

> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com


> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2002-05-05 22:29 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-03-17 05:19 trigger problem! jreniz <jreniz@tutopia.com>
2001-03-18 20:40 ` Peter Eisentraut <peter_e@gmx.net>
2002-05-03 11:17 Trigger problem jquest jquest <jquest_j@hotmail.com>
2002-05-03 15:57 ` Re: Trigger problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-05 22:29 ` Re: Trigger problem Aaron Spiteri <aaron@m1group.com.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox