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
1f023f92
Commit
1f023f92
authored
Dec 07, 2012
by
Simon Riggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize COPY FREEZE with CREATE TABLE also.
Jeff Davis, additional test by me
parent
1eb6cee4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
4 deletions
+19
-4
src/backend/commands/copy.c
src/backend/commands/copy.c
+2
-1
src/test/regress/expected/copy2.out
src/test/regress/expected/copy2.out
+10
-2
src/test/regress/sql/copy2.sql
src/test/regress/sql/copy2.sql
+7
-1
No files found.
src/backend/commands/copy.c
View file @
1f023f92
...
@@ -2002,7 +2002,8 @@ CopyFrom(CopyState cstate)
...
@@ -2002,7 +2002,8 @@ CopyFrom(CopyState cstate)
if
(
cstate
->
freeze
&&
if
(
cstate
->
freeze
&&
ThereAreNoPriorRegisteredSnapshots
()
&&
ThereAreNoPriorRegisteredSnapshots
()
&&
ThereAreNoReadyPortals
()
&&
ThereAreNoReadyPortals
()
&&
cstate
->
rel
->
rd_newRelfilenodeSubid
==
GetCurrentSubTransactionId
())
(
cstate
->
rel
->
rd_newRelfilenodeSubid
==
GetCurrentSubTransactionId
()
||
cstate
->
rel
->
rd_createSubid
==
GetCurrentSubTransactionId
()))
hi_options
|=
HEAP_INSERT_FROZEN
;
hi_options
|=
HEAP_INSERT_FROZEN
;
}
}
...
...
src/test/regress/expected/copy2.out
View file @
1f023f92
...
@@ -254,7 +254,17 @@ SELECT * FROM testnull;
...
@@ -254,7 +254,17 @@ SELECT * FROM testnull;
|
|
(4 rows)
(4 rows)
BEGIN;
CREATE TABLE vistest (LIKE testeoc);
CREATE TABLE vistest (LIKE testeoc);
COPY vistest FROM stdin CSV;
COMMIT;
SELECT xmax, * FROM vistest;
xmax | a
------+----
0 | a0
0 | b
(2 rows)
BEGIN;
BEGIN;
TRUNCATE vistest;
TRUNCATE vistest;
COPY vistest FROM stdin CSV;
COPY vistest FROM stdin CSV;
...
@@ -324,14 +334,12 @@ SELECT * FROM vistest;
...
@@ -324,14 +334,12 @@ SELECT * FROM vistest;
COMMIT;
COMMIT;
TRUNCATE vistest;
TRUNCATE vistest;
COPY vistest FROM stdin CSV FREEZE;
COPY vistest FROM stdin CSV FREEZE;
NOTICE: FREEZE option specified but pre-conditions not met
BEGIN;
BEGIN;
INSERT INTO vistest VALUES ('z');
INSERT INTO vistest VALUES ('z');
SAVEPOINT s1;
SAVEPOINT s1;
TRUNCATE vistest;
TRUNCATE vistest;
ROLLBACK TO SAVEPOINT s1;
ROLLBACK TO SAVEPOINT s1;
COPY vistest FROM stdin CSV FREEZE;
COPY vistest FROM stdin CSV FREEZE;
NOTICE: FREEZE option specified but pre-conditions not met
SELECT * FROM vistest;
SELECT * FROM vistest;
a
a
----
----
...
...
src/test/regress/sql/copy2.sql
View file @
1f023f92
...
@@ -178,8 +178,14 @@ COPY testnull FROM stdin WITH NULL AS E'\\0';
...
@@ -178,8 +178,14 @@ COPY testnull FROM stdin WITH NULL AS E'\\0';
SELECT
*
FROM
testnull
;
SELECT
*
FROM
testnull
;
BEGIN
;
CREATE
TABLE
vistest
(
LIKE
testeoc
);
CREATE
TABLE
vistest
(
LIKE
testeoc
);
COPY
vistest
FROM
stdin
CSV
;
a0
b
\
.
COMMIT
;
SELECT
*
FROM
vistest
;
BEGIN
;
BEGIN
;
TRUNCATE
vistest
;
TRUNCATE
vistest
;
COPY
vistest
FROM
stdin
CSV
;
COPY
vistest
FROM
stdin
CSV
;
...
...
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