hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject incubator-hawq git commit: HAWQ-418. Fix core dump when COPY data into table without any column
Date Fri, 19 Feb 2016 02:02:52 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master f988a7120 -> 0617aa214


HAWQ-418. Fix core dump when COPY data into table without any column


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/0617aa21
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/0617aa21
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/0617aa21

Branch: refs/heads/master
Commit: 0617aa21463b23330bb439b87128125fbb845971
Parents: f988a71
Author: Ruilong Huo <rhuo@pivotal.io>
Authored: Tue Feb 16 22:24:09 2016 -0800
Committer: Ruilong Huo <rhuo@pivotal.io>
Committed: Thu Feb 18 17:57:34 2016 -0800

----------------------------------------------------------------------
 src/backend/commands/copy.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/0617aa21/src/backend/commands/copy.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index acf303c..35a2c0d 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -5544,6 +5544,12 @@ CopyReadAttributesCSV(CopyState cstate, bool *nulls, int *attr_offsets,
 						 errmsg("extra data after last expected column"),
 						 errOmitLocation(true)));
 
+			if(cur == NULL)
+				ereport(ERROR,
+						(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
+						 errmsg("extra data after last expected column"),
+						 errOmitLocation(true)));
+
 			if (in_quote)
 			{
 				/* next c will usually be LF, but it could also be a quote
@@ -5595,6 +5601,12 @@ CopyReadAttributesCSV(CopyState cstate, bool *nulls, int *attr_offsets,
 			/* check whether raw input matched null marker */
 			input_len = end_cursor - start_cursor;
 
+			if (cur == NULL)
+				ereport(ERROR,
+						(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
+						 errmsg("extra data after last expected column"),
+						 errOmitLocation(true)));
+
 			if(num_phys_attrs > 0)
 			{
 				if (!saw_quote && input_len == cstate->null_print_len &&


Mime
View raw message