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
e8ae0196
Commit
e8ae0196
authored
Feb 02, 2013
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust COPY FREEZE error message to be more accurate and consistent.
Per suggestions from Noah and Tom.
parent
f4987049
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
30 deletions
+26
-30
src/backend/commands/copy.c
src/backend/commands/copy.c
+23
-27
src/test/regress/expected/copy2.out
src/test/regress/expected/copy2.out
+3
-3
No files found.
src/backend/commands/copy.c
View file @
e8ae0196
...
...
@@ -1996,36 +1996,32 @@ CopyFrom(CopyState cstate)
hi_options
|=
HEAP_INSERT_SKIP_FSM
;
if
(
!
XLogIsNeeded
())
hi_options
|=
HEAP_INSERT_SKIP_WAL
;
}
/*
* Optimize if new relfilenode was created in this subxact or
* one of its committed children and we won't see those rows later
* as part of an earlier scan or command. This ensures that if this
* subtransaction aborts then the frozen rows won't be visible
* after xact cleanup. Note that the stronger test of exactly
* which subtransaction created it is crucial for correctness
* of this optimisation.
*/
if
(
cstate
->
freeze
)
{
if
(
!
ThereAreNoPriorRegisteredSnapshots
()
||
!
ThereAreNoReadyPortals
())
ereport
(
ERROR
,
(
ERRCODE_INVALID_TRANSACTION_STATE
,
errmsg
(
"cannot perform FREEZE because of prior transaction activity"
)));
/*
* Optimize if new relfilenode was created in this subxact or
* one of its committed children and we won't see those rows later
* as part of an earlier scan or command. This ensures that if this
* subtransaction aborts then the frozen rows won't be visible
* after xact cleanup. Note that the stronger test of exactly
* which subtransaction created it is crucial for correctness
* of this optimisation.
*/
if
(
cstate
->
freeze
)
{
if
(
!
ThereAreNoPriorRegisteredSnapshots
()
||
!
ThereAreNoReadyPortals
())
ereport
(
ERROR
,
(
ERRCODE_INVALID_TRANSACTION_STATE
,
errmsg
(
"cannot perform FREEZE because of prior transaction activity"
)));
if
(
cstate
->
rel
->
rd_createSubid
==
GetCurrentSubTransactionId
()
||
cstate
->
rel
->
rd_newRelfilenodeSubid
==
GetCurrentSubTransactionId
())
hi_options
|=
HEAP_INSERT_FROZEN
;
else
ereport
(
ERROR
,
(
ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
,
errmsg
(
"cannot perform FREEZE because of transaction activity after table creation or truncation"
)));
}
if
(
cstate
->
rel
->
rd_createSubid
!=
GetCurrentSubTransactionId
()
&&
cstate
->
rel
->
rd_newRelfilenodeSubid
!=
GetCurrentSubTransactionId
())
ereport
(
ERROR
,
(
ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
,
errmsg
(
"cannot perform FREEZE because the table was not created or truncated in the current subtransaction"
)));
hi_options
|=
HEAP_INSERT_FROZEN
;
}
else
if
(
cstate
->
freeze
)
ereport
(
ERROR
,
(
ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
,
errmsg
(
"cannot perform FREEZE because the table was not created or truncated in the current transaction"
)));
/*
* We need a ResultRelInfo so we can use the regular executor's
...
...
src/test/regress/expected/copy2.out
View file @
e8ae0196
...
...
@@ -334,12 +334,12 @@ SELECT * FROM vistest;
COMMIT;
TRUNCATE vistest;
COPY vistest FROM stdin CSV FREEZE;
ERROR: cannot perform FREEZE because the table was not created or truncated in the current transaction
ERROR: cannot perform FREEZE because the table was not created or truncated in the current
sub
transaction
BEGIN;
TRUNCATE vistest;
SAVEPOINT s1;
COPY vistest FROM stdin CSV FREEZE;
ERROR: cannot perform FREEZE because
of transaction activity after table creation or trunca
tion
ERROR: cannot perform FREEZE because
the table was not created or truncated in the current subtransac
tion
COMMIT;
BEGIN;
INSERT INTO vistest VALUES ('z');
...
...
@@ -347,7 +347,7 @@ SAVEPOINT s1;
TRUNCATE vistest;
ROLLBACK TO SAVEPOINT s1;
COPY vistest FROM stdin CSV FREEZE;
ERROR: cannot perform FREEZE because the table was not created or truncated in the current transaction
ERROR: cannot perform FREEZE because the table was not created or truncated in the current
sub
transaction
COMMIT;
CREATE FUNCTION truncate_in_subxact() RETURNS VOID AS
$$
...
...
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