0
(以下のサンプルコードを使用しています)私は、明確に定義された(再コンパイル可能な)スクリプト列foo.foo_b
はスクリプト内で正常に実行されましたが、存在しませんでした。Postgresの複合型ドロップカスケードは従属列のみを削除します
テストコード:
-- foo.sql type script
drop type if exists foo cascade ;
create type foo as (
--foo_b bar, -- (a) not there in first script version
foo_c char
) ;
-- bar.sql type script
drop type if exists bar cascade ;
create type bar as (
bar_i int
) ;
-- simple sample code that may cause the strange error
select (null::foo).* ;
--select (null::foo).foo_b ; -- (a) not there in first script version
(あると)outcommented (a)
でスクリプトを実行:
(0 rows affected)
(0 rows affected)
(0 rows affected)
(0 rows affected)
foo_c
-----
-
(0 rows affected)
使用して私たちの新しいfoo_b
列でスクリプトを実行(削除コメント--
プレフィックス上記から2 (a)
-marked lines):
(0 rows affected)
(0 rows affected)
(0 rows affected)
(0 rows affected)
foo_c
-----
-
(0 rows affected)
ERROR: column "foo_b" not found in data type foo
Position: 9
私の元のSQLが異なっていたし、実際には同じ原因の別のエラーが発生します。
select row(null::bar, 'xxx')
ERROR: cannot cast type record to foo
Detail: Input has too many columns.
Position: 7818
'bar'が' table'(または暗黙的に作成された型)の場合は、テーブルにも同じことが適用されます。 –