Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit902338e

Browse files
committed
Convert some mulit-line comments in copy.c to single line, as appropriate.
1 parentfba2a10 commit902338e

File tree

1 file changed

+29
-85
lines changed

1 file changed

+29
-85
lines changed

‎src/backend/commands/copy.c

Lines changed: 29 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.241 2005/05/01 18:56:18 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.242 2005/05/06 02:56:42 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -818,17 +818,13 @@ DoCopy(const CopyStmt *stmt)
818818
escape=quote;
819819
}
820820

821-
/*
822-
* Only single-character delimiter strings are supported.
823-
*/
821+
/* Only single-character delimiter strings are supported. */
824822
if (strlen(delim)!=1)
825823
ereport(ERROR,
826824
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
827825
errmsg("COPY delimiter must be a single character")));
828826

829-
/*
830-
* Check quote
831-
*/
827+
/* Check quote */
832828
if (!csv_mode&&quote!=NULL)
833829
ereport(ERROR,
834830
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@@ -839,9 +835,7 @@ DoCopy(const CopyStmt *stmt)
839835
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
840836
errmsg("COPY quote must be a single character")));
841837

842-
/*
843-
* Check escape
844-
*/
838+
/* Check escape */
845839
if (!csv_mode&&escape!=NULL)
846840
ereport(ERROR,
847841
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@@ -852,9 +846,7 @@ DoCopy(const CopyStmt *stmt)
852846
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
853847
errmsg("COPY escape must be a single character")));
854848

855-
/*
856-
* Check force_quote
857-
*/
849+
/* Check force_quote */
858850
if (!csv_mode&&force_quote!=NIL)
859851
ereport(ERROR,
860852
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@@ -864,9 +856,7 @@ DoCopy(const CopyStmt *stmt)
864856
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
865857
errmsg("COPY force quote only available using COPY TO")));
866858

867-
/*
868-
* Check force_notnull
869-
*/
859+
/* Check force_notnull */
870860
if (!csv_mode&&force_notnull!=NIL)
871861
ereport(ERROR,
872862
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@@ -876,25 +866,19 @@ DoCopy(const CopyStmt *stmt)
876866
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
877867
errmsg("COPY force not null only available using COPY FROM")));
878868

879-
/*
880-
* Don't allow the delimiter to appear in the null string.
881-
*/
869+
/* Don't allow the delimiter to appear in the null string. */
882870
if (strchr(null_print,delim[0])!=NULL)
883871
ereport(ERROR,
884872
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
885873
errmsg("COPY delimiter must not appear in the NULL specification")));
886874

887-
/*
888-
* Don't allow the csv quote char to appear in the null string.
889-
*/
875+
/* Don't allow the csv quote char to appear in the null string. */
890876
if (csv_mode&&strchr(null_print,quote[0])!=NULL)
891877
ereport(ERROR,
892878
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
893879
errmsg("CSV quote character must not appear in the NULL specification")));
894880

895-
/*
896-
* Open and lock the relation, using the appropriate lock type.
897-
*/
881+
/* Open and lock the relation, using the appropriate lock type. */
898882
rel=heap_openrv(relation, (is_from ?RowExclusiveLock :AccessShareLock));
899883

900884
/* check read-only transaction */
@@ -916,23 +900,17 @@ DoCopy(const CopyStmt *stmt)
916900
errhint("Anyone can COPY to stdout or from stdin. "
917901
"psql's \\copy command also works for anyone.")));
918902

919-
/*
920-
* Don't allow COPY w/ OIDs to or from a table without them
921-
*/
903+
/* Don't allow COPY w/ OIDs to or from a table without them */
922904
if (oids&& !rel->rd_rel->relhasoids)
923905
ereport(ERROR,
924906
(errcode(ERRCODE_UNDEFINED_COLUMN),
925907
errmsg("table \"%s\" does not have OIDs",
926908
RelationGetRelationName(rel))));
927909

928-
/*
929-
* Generate or convert list of attributes to process
930-
*/
910+
/* Generate or convert list of attributes to process */
931911
attnumlist=CopyGetAttnums(rel,attnamelist);
932912

933-
/*
934-
* Check that FORCE QUOTE references valid COPY columns
935-
*/
913+
/* Check that FORCE QUOTE references valid COPY columns */
936914
if (force_quote)
937915
{
938916
TupleDesctupDesc=RelationGetDescr(rel);
@@ -953,9 +931,7 @@ DoCopy(const CopyStmt *stmt)
953931
}
954932
}
955933

956-
/*
957-
* Check that FORCE NOT NULL references valid COPY columns
958-
*/
934+
/* Check that FORCE NOT NULL references valid COPY columns */
959935
if (force_notnull)
960936
{
961937
ListCell*cur;
@@ -976,9 +952,7 @@ DoCopy(const CopyStmt *stmt)
976952
}
977953
}
978954

979-
/*
980-
* Set up variables to avoid per-attribute overhead.
981-
*/
955+
/* Set up variables to avoid per-attribute overhead. */
982956
initStringInfo(&attribute_buf);
983957
initStringInfo(&line_buf);
984958
line_buf_converted= false;
@@ -1188,9 +1162,7 @@ CopyTo(Relation rel, List *attnumlist, bool binary, bool oids,
11881162
num_phys_attrs=tupDesc->natts;
11891163
attr_count=list_length(attnumlist);
11901164

1191-
/*
1192-
* Get info about the columns we need to process.
1193-
*/
1165+
/* Get info about the columns we need to process. */
11941166
out_functions= (FmgrInfo*)palloc(num_phys_attrs*sizeof(FmgrInfo));
11951167
force_quote= (bool*)palloc(num_phys_attrs*sizeof(bool));
11961168
foreach(cur,attnumlist)
@@ -1596,9 +1568,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
15961568
}
15971569
}
15981570

1599-
/*
1600-
* Prepare to catch AFTER triggers.
1601-
*/
1571+
/* Prepare to catch AFTER triggers. */
16021572
AfterTriggerBeginQuery();
16031573

16041574
/*
@@ -1743,9 +1713,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
17431713
}
17441714
}
17451715

1746-
/*
1747-
* Loop to read the user attributes on the line.
1748-
*/
1716+
/* Loop to read the user attributes on the line. */
17491717
foreach(cur,attnumlist)
17501718
{
17511719
intattnum=lfirst_int(cur);
@@ -1869,9 +1837,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
18691837
nulls[defmap[i]]=' ';
18701838
}
18711839

1872-
/*
1873-
* Next apply any domain constraints
1874-
*/
1840+
/* Next apply any domain constraints */
18751841
if (hasConstraints)
18761842
{
18771843
ParamExecData*prmdata=&econtext->ecxt_param_exec_vals[0];
@@ -1898,17 +1864,13 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
18981864
}
18991865
}
19001866

1901-
/*
1902-
* And now we can form the input tuple.
1903-
*/
1867+
/* And now we can form the input tuple. */
19041868
tuple=heap_formtuple(tupDesc,values,nulls);
19051869

19061870
if (oids&&file_has_oids)
19071871
HeapTupleSetOid(tuple,loaded_oid);
19081872

1909-
/*
1910-
* Triggers and stuff need to be invoked in query context.
1911-
*/
1873+
/* Triggers and stuff need to be invoked in query context. */
19121874
MemoryContextSwitchTo(oldcontext);
19131875

19141876
skip_tuple= false;
@@ -1935,15 +1897,11 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
19351897
/* Place tuple in tuple slot */
19361898
ExecStoreTuple(tuple,slot,InvalidBuffer, false);
19371899

1938-
/*
1939-
* Check the constraints of the tuple
1940-
*/
1900+
/* Check the constraints of the tuple */
19411901
if (rel->rd_att->constr)
19421902
ExecConstraints(resultRelInfo,slot,estate);
19431903

1944-
/*
1945-
* OK, store the tuple and create index entries for it
1946-
*/
1904+
/* OK, store the tuple and create index entries for it */
19471905
simple_heap_insert(rel,tuple);
19481906

19491907
if (resultRelInfo->ri_NumIndices>0)
@@ -1954,21 +1912,15 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
19541912
}
19551913
}
19561914

1957-
/*
1958-
* Done, clean up
1959-
*/
1915+
/* Done, clean up */
19601916
error_context_stack=errcontext.previous;
19611917

19621918
MemoryContextSwitchTo(oldcontext);
19631919

1964-
/*
1965-
* Execute AFTER STATEMENT insertion triggers
1966-
*/
1920+
/* Execute AFTER STATEMENT insertion triggers */
19671921
ExecASInsertTriggers(estate,resultRelInfo);
19681922

1969-
/*
1970-
* Handle queued AFTER triggers
1971-
*/
1923+
/* Handle queued AFTER triggers */
19721924
AfterTriggerEndQuery(estate);
19731925

19741926
pfree(values);
@@ -2255,9 +2207,7 @@ CopyReadLine(char * quote, char * escape)
22552207
}
22562208
}/* end of outer loop */
22572209

2258-
/*
2259-
* Done reading the line. Convert it to server encoding.
2260-
*/
2210+
/* Done reading the line. Convert it to server encoding. */
22612211
if (change_encoding)
22622212
{
22632213
cvt= (char*)pg_client_to_server((unsignedchar*)line_buf.data,
@@ -2457,28 +2407,22 @@ CopyReadAttributeCSV(const char *delim, const char *null_print, char *quote,
24572407
break;
24582408
c=line_buf.data[line_buf.cursor++];
24592409

2460-
/*
2461-
* unquoted field delimiter
2462-
*/
2410+
/* unquoted field delimiter */
24632411
if (!in_quote&&c==delimc)
24642412
{
24652413
*result=NORMAL_ATTR;
24662414
break;
24672415
}
24682416

2469-
/*
2470-
* start of quoted field (or part of field)
2471-
*/
2417+
/* start of quoted field (or part of field) */
24722418
if (!in_quote&&c==quotec)
24732419
{
24742420
saw_quote= true;
24752421
in_quote= true;
24762422
continue;
24772423
}
24782424

2479-
/*
2480-
* escape within a quoted field
2481-
*/
2425+
/* escape within a quoted field */
24822426
if (in_quote&&c==escapec)
24832427
{
24842428
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp