petere / pguri

uri type for PostgreSQL

Home Page:https://twitter.com/pvh/status/567395527357001728

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Foreign keys ERROR: could not find hash function for hash operator 929350

chanmix51 opened this issue · comments

We are building a CMS and using the uri type in the database to archive pointers to each article to properly handle redirection. To do so, the article table has a current uri that must be present in the article_url table as well. When I try to apply the DDL file that alters the table to add the foreign key constraint, it pops the following error out:

ALTER TABLE ONLY article_i18n
    ADD CONSTRAINT article_id_supported_culture_uri_fk FOREIGN KEY (article_id, supported_culture_id, uri) REFERENCES article_url(article_id, supported_culture_id, article_url) MATCH FULL;
psql:sources/schema/postgres/post-data.sql:316: ERROR:  could not find hash function for hash operator 929350
CONTEXTE : SQL statement "SELECT fk."article_id", fk."supported_culture_id", fk."uri" FROM ONLY "article"."article_i18n" fk LEFT OUTER JOIN ONLY "article"."article_url" pk ON ( pk."article_id" OPERATOR(pg_catalog.=) fk."article_id" AND pk.
"supported_culture_id" OPERATOR(pg_catalog.=) fk."supported_culture_id" AND pk."article_url" OPERATOR(public.=) fk."uri") WHERE pk."article_id" IS NULL AND (fk."article_id" IS NOT NULL OR fk."supported_culture_id" IS NOT NULL OR fk."uri" I
S NOT NULL)"

When I test for the operator 929350, it says it is the = operator:

select 929350::regoperator;
┌─────────────┐
│ regoperator │
├─────────────┤
│ =(uri,uri)  │
└─────────────┘
(1 row)
PostgreSQL 9.4.3 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit