[Help] AGGREGATE problem w/v7.0

From: "Itzinger, Oskar" <oitzinger(at)opec(dot)org>
To: pgsql-general(at)postgresql(dot)org
Cc: "Itzinger, Oskar" <oitzinger(at)opec(dot)org>
Subject: [Help] AGGREGATE problem w/v7.0
Date: 2001-06-13 09:15:37
Message-ID: FD2A5FEE4C3AD511A77B00508BB8538A01190C@OPECEXCH
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Under PostgreSQl 7.0, running the following from a shell script,

#!/sbin/sh

psql mybase << END

CREATE FUNCTION foo(TEXT, TEXT) RETURNS TEXT AS
'SELECT \$1 || '', '' || \$2'
LANGUAGE 'sql';

CREATE AGGREGATE foo_a (
BASETYPE = TEXT,
SFUNC1 = foo,
STYPE1 = TEXT,
INITCOND1 = ''
);

CREATE TEMPORARY TABLE tmp (id TEXT, entry TEXT);
INSERT INTO tmp VALUES('abc', 'kls');
INSERT INTO tmp VALUES('abc', 'mnr');
INSERT INTO tmp VALUES('def', 'opq');
INSERT INTO tmp VALUES('def', 'zyw');

SELECT id, foo_a(entry) FROM tmp GROUP BY id;

END

/why/ does SELECT give up with

ERROR: SQL-language function not supported in this context.

- Is this a bug/limitation (at least the Programmer's Guide for PostgreSQL
7.0,
Chapters 4 & 7, doesn't seem to volunteer a clue)?
- What am I doing wrongly?
- What exactly is meant by "this context"?
- How can I rectify this situation (besides hacking up Perl code for my
purpose, which I finally did)?

Thanks for your advice.

/oskar

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Allan Kamau 2001-06-13 09:36:15 PLPGSQL: Using Transactions and locks
Previous Message F. Masselink 2001-06-13 08:49:49 function / trigger problem