偶然地(混淆了参数的顺序),我在postgres实例中将列类型设置为IMAGE ),它成功了(没有得到错误)!我不知道这种类型是什么,也没有在正式类型表中列出。
mydb=# CREATE TABLE tmp_image( image_column image );
CREATE TABLE
mydb=# \d tmp_image
Table "public.tmp_image"
Column | Type | Collation | Nullable | Default
--------------+-------+-----------+----------+---------
image_column | image | | | 搜索一下,我找到了pg_image,但是我没有安装任何扩展:
\dx
List of installed extensions
Name | Version | Schema | Description
---------+---------+------------+------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language我好像在运行10.7 (psql (PostgreSQL) 10.7 (Ubuntu 10.7-0ubuntu0.18.04.1))。
发布于 2019-04-12 13:31:40
您创建了一个复合型 (偶然?)。从医生那里:
每当创建表时,还会自动创建与表同名的复合类型,以表示表的行类型。
同样的事情似乎也适用于观点,即使我找不到这个说明的解释。不管怎样,看看这个:
postgres=# CREATE TABLE test (id int, data text);
CREATE TABLE
postgres=# CREATE TABLE test2 (id int, field test); -- note the type of [field]
CREATE TABLE
postgres=# INSERT INTO test2 (id, field) VALUES (2, ROW(1, 'test'));
INSERT 0 1
postgres=# SELECT * FROM test2;
id | field
----+-------
2 | (1,test)
(1 row)
postgres=# SELECT (field).data FROM test2;
data
------
test
(1 row)
postgres=# SELECT * FROM test;
id
----
(0 rows)注意test是如何成为test2的一部分的。它的不是的外国参考。
https://stackoverflow.com/questions/55649939
复制相似问题