Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D113263329F for ; Fri, 19 Feb 2010 06:29:00 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 82774-07 for ; Fri, 19 Feb 2010 10:28:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-yx0-f190.google.com (mail-yx0-f190.google.com [209.85.210.190]) by mail.postgresql.org (Postfix) with ESMTP id 5BB53633128 for ; Fri, 19 Feb 2010 06:28:50 -0400 (AST) Received: by yxe28 with SMTP id 28so7092368yxe.29 for ; Fri, 19 Feb 2010 02:28:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=FMzOhc7rVkYLiwt56b4Rw4egBwS1FVmcxtBaurslP3I=; b=TmdOV/OYC658m0qvVJfemiBdNTGiEREE9ogbApJFAJ8f/72K5bHwU6rKoUEMx8nHA1 A1DcB0LVt6JdufqvJoOqiWwBBSbhg6G5/qiwqYTBsWOcxXLjaP9RMHiNl2MED9NUPhTs G+lVjWuJ/cuQhdIQRp/Apu/v2Pj/P/yJ7rTvQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=S4PutPnYimXDdn5o6FIRvL/RriRwQngZfaweMTTKy3kwUgeMsFNXtcUL/VUSzshKvl 9QqNNzkZceA7M4bLURbUz4pBVLvqdwryO9fj0GmZ5HczRpOdUuC0mn8KSdQbLWGUI5CB zdwZHN0y2XiVBcrPsA6XLFZFkoaluHWU50h8c= Received: by 10.150.209.15 with SMTP id h15mr1107623ybg.267.1266565948232; Thu, 18 Feb 2010 23:52:28 -0800 (PST) Received: from ?192.168.1.3? ([189.115.187.187]) by mx.google.com with ESMTPS id 39sm4029078yxd.9.2010.02.18.23.52.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 18 Feb 2010 23:52:25 -0800 (PST) Message-ID: <4B7E4331.1050308@gmail.com> Date: Fri, 19 Feb 2010 04:52:17 -0300 From: iuri de araujo sampaio User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: sintax error Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.74 tagged_above=-10 required=5 tests=BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 201002/76 X-Sequence-Number: 33675 Hi there, i have got the followed error in the pgsql function bellow. Log messages point to: ******************** ERROR: syntax error at end of input LINE 1: SELECT ^ QUERY: SELECT CONTEXT: SQL statement in PL/PgSQL function "cms_permission__revoke_permission" near line 67 ********** Error ********** ERROR: syntax error at end of input SQL state: 42601 Context: SQL statement in PL/PgSQL function "cms_permission__revoke_permission" near line 67 ******************** However, I couldn't find any sintax error in those SELECT statements does anyone have any idea what is wrong with it? cheers, iuri -- procedure revoke_permission create or replace function cms_permission__revoke_permission (integer,integer,varchar,integer,varchar) returns integer as ' declare p_item_id alias for $1; p_holder_id alias for $2; p_privilege alias for $3; p_revokee_id alias for $4; p_is_recursive alias for $5; -- default ''f'' -- v_items item_array_type; v_item_id cr_items.item_id%TYPE; v_idx integer; v_count integer; -- v_perms perm_array_type; v_perm acs_privileges.privilege%TYPE; v_perm_idx integer; v_perm_count integer; c_perm_cur record; c_item_cur record; begin PERFORM update_permissions(p_item_id, p_is_recursive); -- Select the child permissions v_perm_count := 0; for c_perm_cur in select child_privilege from acs_privilege_hierarchy where privilege = p_privilege and child_privilege <> p_privilege LOOP v_perm := c_perm_cur.child_privilege; v_perm_count := v_perm_count + 1; -- v_perms(v_perm_count) := v_perm; update v_perms set value[v_perm_count] = v_perm; end LOOP; -- Select child items v_count := 0; for c_item_cur in select c1.item_id from cr_items c1, cr_items c2 where c2.item_id = p_item_id and c1.tree_sortkey between c2.tree_sortkey and tree_right(c2.tree_sortkey) and cms_permission__has_revoke_authority ( item_id, p_holder_id, p_privilege, p_revokee_id ) = ''t'' and acs_permission__permission_p ( item_id, p_revokee_id, p_privilege ) = ''t'' LOOP v_item_id := c_item_cur.item_id; v_count := v_count + 1; -- v_items(v_count) := v_item_id; update v_items set value[v_count] = v_item_id; exit when p_is_recursive = ''f''; end loop; if v_count < 1 then return; end if; -- Grant child permissions for v_idx in 1..v_count loop for v_perm_idx in 1..v_perm_count loop PERFORM acs_permission__grant_permission ( -- v_items(v_idx), p_revokee_id, v_perms(v_perm_idx) v_items.value[v_idx], p_revokee_id, v_perms.value[v_perm_idx] ); end loop; end loop; -- Revoke the parent permission for v_idx in 1..v_count loop PERFORM acs_permission__revoke_permission ( -- v_items(v_idx), v_items.value[v_idx], p_revokee_id, p_privilege ); end loop; return 0; end;' language 'plpgsql';