我有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