Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcda3e58

Browse files
author
Neil Conway
committed
Add regression tests for the fix committed by Tom for casting between
the row types of parent/child tables.
1 parentc604ed5 commitcda3e58

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

‎src/test/regress/expected/inherit.out

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,3 +623,31 @@ select * from d;
623623
32 | one | two | three
624624
(1 row)
625625

626+
-- Tests for casting between the rowtypes of parent and child
627+
-- tables. See the pgsql-hackers thread beginning Dec. 4/04
628+
create table base (i integer);
629+
create table derived () inherits (base);
630+
insert into derived (i) values (0);
631+
select derived::base from derived;
632+
derived
633+
---------
634+
(0)
635+
(1 row)
636+
637+
drop table derived;
638+
drop table base;
639+
create table p1(ff1 int);
640+
create table p2(f1 text);
641+
create function p2text(p2) returns text as 'select $1.f1' language sql;
642+
create table c1(f3 int) inherits(p1,p2);
643+
insert into c1 values(123456789, 'hi', 42);
644+
select p2text(c1.*) from c1;
645+
p2text
646+
--------
647+
hi
648+
(1 row)
649+
650+
drop function p2text(p2);
651+
drop table c1;
652+
drop table p2;
653+
drop table p1;

‎src/test/regress/sql/inherit.sql

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,25 @@ SELECT * FROM inhf; /* Single entry with value 'text' */
146146

147147
-- Test changing the type of inherited columns
148148
insert into dvalues('test','one','two','three');
149-
150149
altertable a alter column aa typeinteger using bit_length(aa);
151-
152150
select*from d;
151+
152+
-- Tests for casting between the rowtypes of parent and child
153+
-- tables. See the pgsql-hackers thread beginning Dec. 4/04
154+
createtablebase (iinteger);
155+
createtablederived () inherits (base);
156+
insert into derived (i)values (0);
157+
select derived::basefrom derived;
158+
droptable derived;
159+
droptable base;
160+
161+
createtablep1(ff1int);
162+
createtablep2(f1text);
163+
createfunctionp2text(p2) returnstextas'select $1.f1' language sql;
164+
createtablec1(f3int) inherits(p1,p2);
165+
insert into c1values(123456789,'hi',42);
166+
select p2text(c1.*)from c1;
167+
dropfunction p2text(p2);
168+
droptable c1;
169+
droptable p2;
170+
droptable p1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp