我有2个表:涉及PostgreSQL的查询整数[]
CREATE TABLE article (
id serial NOT NULL,
title text,
tags integer[] -- array of tag id's from TAG table
)
CREATE TABLE tag (
id serial NOT NULL,
description character varying(250) NOT NULL
)
...并需要根据文章的标题,以从在文章的“标签整数[]”举行标记表。
所以想是这样
SELECT *
FROM tag
WHERE tag.id IN ((select article.tags::int4
from article
where article.title = 'some title'));
...这使我
ERROR: cannot cast type integer[] to integer
LINE 1: ...FROM tag WHERE tag.id IN ( (select article.tags::int4 from ...
我在这两个开发和生产环境与PostgreSQL 8.3版本卡住。
...无赖,我是8.3,既dev和prod :-( – vector 2011-01-21 17:34:35
...你打赌我,它是,我发现:-) – vector 2011-01-21 17:54:38