Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id B099E475D46 for ; Sun, 26 May 2002 06:53:36 -0400 (EDT) Received: from orion.vo.lu (orion.vo.lu [212.24.194.7]) by postgresql.org (Postfix) with ESMTP id BB8164759AD for ; Sun, 26 May 2002 06:53:34 -0400 (EDT) Received: from 212.24.194.141 (unverified [212.24.194.141]) by orion.vo.lu (Vircom SMTPRS 5.1.202) with ESMTP id for ; Sun, 26 May 2002 12:46:42 +0200 Date: Sun, 26 May 2002 12:53:35 +0200 From: "||//::..-cwhisperer-..:://||" X-Mailer: The Bat! (v1.60c) Business Reply-To: cwhisperer X-Priority: 3 (Normal) Message-ID: <9069492264.20020526125335@vo.lu> To: pgsql-sql@postgresql.org Subject: uinique identifier MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200205/275 X-Sequence-Number: 7910 hi, I want to create an unique identifier for all the tables in my db. as paramater I pass the length of the identifier and the table name: here my function DROP FUNCTION ui_alz_table (int4,varchar); CREATE FUNCTION ui_alz_table (int4,varchar) RETURNS varchar AS ' DECLARE iLoop int4; result varchar; nr int4; query_string varchar; BEGIN result := ''''; nr := 1; IF ($1>0) AND ($1 < 255) THEN WHILE nr > 0 LOOP FOR iLoop in 1 .. $1 LOOP result := result || chr(int4(random()*25)+65); END LOOP; query_string := ''Select * from ''|| $2 || '' where id = '' || result; EXECUTE query_string; IF NOT FOUND THEN nr := 0; END IF; END LOOP; RETURN result; END IF; END; ' LANGUAGE 'plpgsql'; in the for loop I create the unique identifier and whith the query_string I check whetherit exists or not. but I get an error 'Attribute xxxx not found' and I don't know what to to with it. thx for your help -- Best regards, ||//::..-cwhisperer-..:://|| mailto:cwhisperer@vo.lu