pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to reference a composite type in schemas not "public"?
6+ messages / 2 participants
[nested] [flat]
* How to reference a composite type in schemas not "public"?
@ 2018-06-14 03:34 a <372660931@qq.com>
2018-06-14 04:06 ` Re: How to reference a composite type in schemas not "public"? Adrian Klaver <adrian.klaver@aklaver.com>
2018-06-14 13:26 ` Re: How to reference a composite type in schemas not "public"? Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 2 replies; 6+ messages in thread
From: a @ 2018-06-14 03:34 UTC (permalink / raw)
To: pgsql-general
Hi I have created some composite type:
create type "MjorTbl".mort as(
adjfac float8,
tablename text,
subtype text,
improv float8,
selfac slfc
);
The schema is different from public, while I would like to create table using the composite type, it reports a error:
create type "MjorTbl".decrmt as(
nodecrmt int4,
mortality "MjorTbl"."mort"
);
ERROR: type "MjorTbl.mort" does not exist
SQL state: 42704
create type "MjorTbl".decrmt as(
nodecrmt int4,
mortality mort
);
ERROR: type "mort" does not exist
SQL state: 42704
How can I reference the created composite type correctly??
Thanks
Shore
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How to reference a composite type in schemas not "public"?
2018-06-14 03:34 How to reference a composite type in schemas not "public"? a <372660931@qq.com>
@ 2018-06-14 04:06 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-06-14 04:55 ` Re: How to reference a composite type in schemas not "public"? a <372660931@qq.com>
2018-06-14 05:34 ` Re: How to reference a composite type in schemas not "public"? a <372660931@qq.com>
1 sibling, 2 replies; 6+ messages in thread
From: Adrian Klaver @ 2018-06-14 04:06 UTC (permalink / raw)
To: a <372660931@qq.com>; pgsql-general
On 06/13/2018 08:34 PM, a wrote:
> Hi I have created some composite type:
>
> create type "MjorTbl".mort as(
> adjfac float8,
> tablename text,
> subtype text,
> improv float8,
> selfac slfc
> );
>
> The schema is different from public, while I would like to create table
> using the composite type, it reports a error:
>
> create type "MjorTbl".decrmt as(
> nodecrmt int4,
> mortality "MjorTbl"."mort"
> );
>
> ERROR: type "MjorTbl.mort" does not exist
> SQL state: 42704
In psql what does \dn show?
>
> create type "MjorTbl".decrmt as(
> nodecrmt int4,
> mortality mort
> );
>
> ERROR: type "mort" does not exist
> SQL state: 42704
>
> How can I reference the created composite type correctly??
>
> Thanks
>
> Shore
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How to reference a composite type in schemas not "public"?
2018-06-14 03:34 How to reference a composite type in schemas not "public"? a <372660931@qq.com>
2018-06-14 04:06 ` Re: How to reference a composite type in schemas not "public"? Adrian Klaver <adrian.klaver@aklaver.com>
@ 2018-06-14 04:55 ` a <372660931@qq.com>
1 sibling, 0 replies; 6+ messages in thread
From: a @ 2018-06-14 04:55 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general
Hey thank you~
postgres=# \dn
架构模式列表
名称 | 拥有者
---------+----------
pgagent | postgres
public | postgres
(2 行记录)
------------------ Original ------------------
From: "Adrian Klaver";
Date: Thursday, Jun 14, 2018 12:06 PM
To: "a"<372660931@qq.com>; "pgsql-general";
Subject: Re: How to reference a composite type in schemas not "public"?
On 06/13/2018 08:34 PM, a wrote:
> Hi I have created some composite type:
>
> create type "MjorTbl".mort as(
> adjfac float8,
> tablename text,
> subtype text,
> improv float8,
> selfac slfc
> );
>
> The schema is different from public, while I would like to create table
> using the composite type, it reports a error:
>
> create type "MjorTbl".decrmt as(
> nodecrmt int4,
> mortality "MjorTbl"."mort"
> );
>
> ERROR: type "MjorTbl.mort" does not exist
> SQL state: 42704
In psql what does \dn show?
>
> create type "MjorTbl".decrmt as(
> nodecrmt int4,
> mortality mort
> );
>
> ERROR: type "mort" does not exist
> SQL state: 42704
>
> How can I reference the created composite type correctly??
>
> Thanks
>
> Shore
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How to reference a composite type in schemas not "public"?
2018-06-14 03:34 How to reference a composite type in schemas not "public"? a <372660931@qq.com>
2018-06-14 04:06 ` Re: How to reference a composite type in schemas not "public"? Adrian Klaver <adrian.klaver@aklaver.com>
@ 2018-06-14 05:34 ` a <372660931@qq.com>
2018-06-14 13:37 ` Re: How to reference a composite type in schemas not "public"? Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 1 reply; 6+ messages in thread
From: a @ 2018-06-14 05:34 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general
Sorry I was in the wrong db last time
TESTDB=# \dn
架构模式列表
名称 | 拥有者
---------+----------
MjorTbl | postgres
Rate | postgres
public | postgres
------------------ Original ------------------
From: "Adrian Klaver";<adrian.klaver@aklaver.com>;
Date: Jun 14, 2018
To: "a"<372660931@qq.com>; "pgsql-general"<pgsql-general@postgresql.org>;
Subject: Re: How to reference a composite type in schemas not "public"?
On 06/13/2018 08:34 PM, a wrote:
> Hi I have created some composite type:
>
> create type "MjorTbl".mort as(
> adjfac float8,
> tablename text,
> subtype text,
> improv float8,
> selfac slfc
> );
>
> The schema is different from public, while I would like to create table
> using the composite type, it reports a error:
>
> create type "MjorTbl".decrmt as(
> nodecrmt int4,
> mortality "MjorTbl"."mort"
> );
>
> ERROR: type "MjorTbl.mort" does not exist
> SQL state: 42704
In psql what does \dn show?
>
> create type "MjorTbl".decrmt as(
> nodecrmt int4,
> mortality mort
> );
>
> ERROR: type "mort" does not exist
> SQL state: 42704
>
> How can I reference the created composite type correctly??
>
> Thanks
>
> Shore
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How to reference a composite type in schemas not "public"?
2018-06-14 03:34 How to reference a composite type in schemas not "public"? a <372660931@qq.com>
2018-06-14 04:06 ` Re: How to reference a composite type in schemas not "public"? Adrian Klaver <adrian.klaver@aklaver.com>
2018-06-14 05:34 ` Re: How to reference a composite type in schemas not "public"? a <372660931@qq.com>
@ 2018-06-14 13:37 ` Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 0 replies; 6+ messages in thread
From: Adrian Klaver @ 2018-06-14 13:37 UTC (permalink / raw)
To: a <372660931@qq.com>; pgsql-general
On 06/13/2018 10:34 PM, a wrote:
> Sorry I was in the wrong db last time
>
> TESTDB=# \dn
> �0�2 �0�2 架构模式列表
> �0�2 名称�0�2 �0�2|�0�2 拥有者
> ---------+----------
> �0�2MjorTbl | postgres
> �0�2Rate�0�2 �0�2 | postgres
> �0�2public�0�2 | postgres
>
>
In addition try:
\dT "MjorTbl".mort
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: How to reference a composite type in schemas not "public"?
2018-06-14 03:34 How to reference a composite type in schemas not "public"? a <372660931@qq.com>
@ 2018-06-14 13:26 ` Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 0 replies; 6+ messages in thread
From: Adrian Klaver @ 2018-06-14 13:26 UTC (permalink / raw)
To: a <372660931@qq.com>; pgsql-general
On 06/13/2018 08:34 PM, a wrote:
> Hi I have created some composite type:
>
> create type "MjorTbl".mort as(
> adjfac float8,
> tablename text,
> subtype text,
> improv float8,
> selfac slfc
> );
>
> The schema is different from public, while I would like to create table
> using the composite type, it reports a error:
>
> create type "MjorTbl".decrmt as(
> nodecrmt int4,
> mortality "MjorTbl"."mort"
> );
>
> ERROR: type "MjorTbl.mort" does not exist
> SQL state: 42704
>
> create type "MjorTbl".decrmt as(
> nodecrmt int4,
> mortality mort
> );
>
> ERROR: type "mort" does not exist
> SQL state: 42704
>
> How can I reference the created composite type correctly??
Well it works here:
select version();
version
------------------------------------------------------------------------------------
PostgreSQL 10.4 on x86_64-pc-linux-gnu, compiled by gcc (SUSE Linux)
4.8.5, 64-bit
create schema "MjorTbl";
CREATE SCHEMA
create type "MjorTbl".mort as(
adjfac float8,
tablename text,
subtype text,
improv float8
);
CREATE TYPE
create type "MjorTbl".decrmt as(
nodecrmt int4,
mortality "MjorTbl"."mort"
);
CREATE TYPE
You might have a permissions issue. In your original post where all the
commands run as the same user and from the same schema?
>
> Thanks
>
> Shore
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2018-06-14 13:37 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-14 03:34 How to reference a composite type in schemas not "public"? a <372660931@qq.com>
2018-06-14 04:06 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-06-14 04:55 ` a <372660931@qq.com>
2018-06-14 05:34 ` a <372660931@qq.com>
2018-06-14 13:37 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-06-14 13:26 ` Adrian Klaver <adrian.klaver@aklaver.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox