On Thu, Jan 24, 2013 at 06:55:17PM -0500, Tom Lane wrote:
> Bruce Momjian <br...@momjian.us> writes:
> >> Didn't we want to issue the user some kind of feedback?
> 
> > As no one wanted to write this patch, I have developed the attached
> > version.
> 
> Please note the comment directly above where you patched.
> 
> The proposed message doesn't seem to me to be following the message
> style guide, either.

OK, updated patch attached.

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
new file mode 100644
index 8778e8b..1086324
*** a/src/backend/commands/copy.c
--- b/src/backend/commands/copy.c
*************** CopyFrom(CopyState cstate)
*** 2009,2023 ****
  		 *
  		 * As noted above rd_newRelfilenodeSubid is not set in all cases
  		 * where we can apply the optimization, so in those rare cases
! 		 * where we cannot honour the request we do so silently.
  		 */
! 		if (cstate->freeze &&
! 			ThereAreNoPriorRegisteredSnapshots() &&
! 			ThereAreNoReadyPortals() &&
! 			(cstate->rel->rd_newRelfilenodeSubid == GetCurrentSubTransactionId() ||
! 			 cstate->rel->rd_createSubid == GetCurrentSubTransactionId()))
! 			hi_options |= HEAP_INSERT_FROZEN;
  	}
  
  	/*
  	 * We need a ResultRelInfo so we can use the regular executor's
--- 2009,2029 ----
  		 *
  		 * As noted above rd_newRelfilenodeSubid is not set in all cases
  		 * where we can apply the optimization, so in those rare cases
! 		 * where we cannot honor the request.
  		 */
! 		if (cstate->freeze)
! 		{
! 			if (ThereAreNoPriorRegisteredSnapshots() &&
! 				ThereAreNoReadyPortals() &&
! 				(cstate->rel->rd_newRelfilenodeSubid == GetCurrentSubTransactionId() ||
! 				 cstate->rel->rd_createSubid == GetCurrentSubTransactionId()))
! 				hi_options |= HEAP_INSERT_FROZEN;
! 			else
! 				ereport(NOTICE, (errmsg("cannot honor FREEZE option")));
! 		}
  	}
+ 	else if (cstate->freeze)
+ 		ereport(NOTICE, (errmsg("cannot honor FREEZE option")));
  
  	/*
  	 * We need a ResultRelInfo so we can use the regular executor's
diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out
new file mode 100644
index 78c601f..9a13479
*** a/src/test/regress/expected/copy2.out
--- b/src/test/regress/expected/copy2.out
*************** SELECT * FROM vistest;
*** 334,345 ****
--- 334,347 ----
  COMMIT;
  TRUNCATE vistest;
  COPY vistest FROM stdin CSV FREEZE;
+ NOTICE:  cannot honor FREEZE option
  BEGIN;
  INSERT INTO vistest VALUES ('z');
  SAVEPOINT s1;
  TRUNCATE vistest;
  ROLLBACK TO SAVEPOINT s1;
  COPY vistest FROM stdin CSV FREEZE;
+ NOTICE:  cannot honor FREEZE option
  SELECT * FROM vistest;
   a  
  ----
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to