Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
cda3e583
Commit
cda3e583
authored
Dec 12, 2004
by
Neil Conway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add regression tests for the fix committed by Tom for casting between
the row types of parent/child tables.
parent
c604ed56
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
2 deletions
+48
-2
src/test/regress/expected/inherit.out
src/test/regress/expected/inherit.out
+28
-0
src/test/regress/sql/inherit.sql
src/test/regress/sql/inherit.sql
+20
-2
No files found.
src/test/regress/expected/inherit.out
View file @
cda3e583
...
...
@@ -623,3 +623,31 @@ select * from d;
32 | one | two | three
(1 row)
-- Tests for casting between the rowtypes of parent and child
-- tables. See the pgsql-hackers thread beginning Dec. 4/04
create table base (i integer);
create table derived () inherits (base);
insert into derived (i) values (0);
select derived::base from derived;
derived
---------
(0)
(1 row)
drop table derived;
drop table base;
create table p1(ff1 int);
create table p2(f1 text);
create function p2text(p2) returns text as 'select $1.f1' language sql;
create table c1(f3 int) inherits(p1,p2);
insert into c1 values(123456789, 'hi', 42);
select p2text(c1.*) from c1;
p2text
--------
hi
(1 row)
drop function p2text(p2);
drop table c1;
drop table p2;
drop table p1;
src/test/regress/sql/inherit.sql
View file @
cda3e583
...
...
@@ -146,7 +146,25 @@ SELECT * FROM inhf; /* Single entry with value 'text' */
-- Test changing the type of inherited columns
insert
into
d
values
(
'test'
,
'one'
,
'two'
,
'three'
);
alter
table
a
alter
column
aa
type
integer
using
bit_length
(
aa
);
select
*
from
d
;
-- Tests for casting between the rowtypes of parent and child
-- tables. See the pgsql-hackers thread beginning Dec. 4/04
create
table
base
(
i
integer
);
create
table
derived
()
inherits
(
base
);
insert
into
derived
(
i
)
values
(
0
);
select
derived
::
base
from
derived
;
drop
table
derived
;
drop
table
base
;
create
table
p1
(
ff1
int
);
create
table
p2
(
f1
text
);
create
function
p2text
(
p2
)
returns
text
as
'select $1.f1'
language
sql
;
create
table
c1
(
f3
int
)
inherits
(
p1
,
p2
);
insert
into
c1
values
(
123456789
,
'hi'
,
42
);
select
p2text
(
c1
.
*
)
from
c1
;
drop
function
p2text
(
p2
);
drop
table
c1
;
drop
table
p2
;
drop
table
p1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment