Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 3E5FC1337BBA for ; Wed, 23 Mar 2011 16:09:20 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 44960-05 for ; Wed, 23 Mar 2011 19:09:19 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 905E21337BB4 for ; Wed, 23 Mar 2011 16:09:19 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p2NJ9Jv0052157 for ; Wed, 23 Mar 2011 19:09:19 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p2NJ9JEc052156; Wed, 23 Mar 2011 19:09:19 GMT (envelope-from www) Date: Wed, 23 Mar 2011 19:09:19 GMT Message-Id: <201103231909.p2NJ9JEc052156@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #5942: pg_trgm.sql has cyclic dependency on type gtrgm creation From: "Arthur Nascimento" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201103/298 X-Sequence-Number: 29808 The following bug has been logged online: Bug reference: 5942 Logged by: Arthur Nascimento Email address: tureba@gmail.com PostgreSQL version: 9.0.3 Operating system: Linux Description: pg_trgm.sql has cyclic dependency on type gtrgm creation Details: When creating the gtrgm type, it depends on gtrgm_{in,out}. These functions also depend on the type, so there is a cyclic dependency on creation of the type. The command psql -f sharedir/contrib/pg_trgm.sql crashes for me accusing this error. According to the CREATE TYPE documentation, this can be solved by adding a "CREATE TYPE gtrgm;" line before the functions are defined. This solution worked locally for me by including that command between lines 40 and 41 of the file. A snippet of the offending code of contrib/pg_trgm.sql, lines 40 to 55: -- gist key CREATE OR REPLACE FUNCTION gtrgm_in(cstring) RETURNS gtrgm AS '$libdir/pg_trgm' LANGUAGE C STRICT; CREATE OR REPLACE FUNCTION gtrgm_out(gtrgm) RETURNS cstring AS '$libdir/pg_trgm' LANGUAGE C STRICT; CREATE TYPE gtrgm ( INTERNALLENGTH = -1, INPUT = gtrgm_in, OUTPUT = gtrgm_out );