Received: from flip.wildbrain.com ([206.54.55.32]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6KJowa87966 for ; Fri, 20 Jul 2001 15:50:58 -0400 (EDT) (envelope-from dado@wildbrain.com) Received: from wildbrain.com (daedelus.wildbrain.com [192.168.1.38]) by flip.wildbrain.com (8.9.3/8.9.3) with ESMTP id LAA06270 for ; Fri, 20 Jul 2001 11:26:04 -0700 Message-ID: <3B5885DE.2070104@wildbrain.com> Date: Fri, 20 Jul 2001 12:26:22 -0700 From: Dado Feigenblatt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010628 X-Accept-Language: en-us MIME-Version: 1.0 To: Pgsql-Sql Subject: PLpgSQL Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200107/284 X-Sequence-Number: 4087 3 questions: 1. Can I use CREATE SEQUENCE inside a function? 2. I can create this function but I can't get it to run: CREATE FUNCTION new_proj_pts_seq(int4) RETURNS text AS 'DECLARE proj_ID alias for $1; seq_name TEXT; BEGIN seq_name := ''proj_pts_'' || proj_ID; create sequence seq_name; END; RETURNS seq_name;' LANGUAGE 'plpgsql'; When I do SELECT new_proj_pts_seq(9000); I get: ERROR: parser: parse error at or near "$1" The same happens if I assign $1 to proj_ID (instead of aliasing), or just use $1 in the string concatenation. I always get the same message. Considering that all the above is possible/fixable... 3. On the statement 'create sequence seq_name;', will 'seq_name' be evaluated properly? Thanks. -- Dado Feigenblatt Wild Brain, Inc. Technical Director (415) 553-8000 x??? dado@wildbrain.com San Francisco, CA.