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

Commitfce7cb6

Browse files
committed
Variable renaming in dbcommands.c
There were several sets of very similar local variable names, such as"downer" and "dbowner", which was very confusing and error-prone.Rename the former to "ownerEl" and so on, similar to collationcmds.cand typecmds.c.Reviewed-by: Daniel Gustafsson <daniel@yesql.se>Discussion:https://www.postgresql.org/message-id/flat/e5bce225-ee04-40c7-a280-ea7214318048%40eisentraut.org
1 parenta3c6aa4 commitfce7cb6

File tree

1 file changed

+89
-89
lines changed

1 file changed

+89
-89
lines changed

‎src/backend/commands/dbcommands.c

Lines changed: 89 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -704,22 +704,22 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
704704
Oiddboid=InvalidOid;
705705
Oiddatdba;
706706
ListCell*option;
707-
DefElem*dtablespacename=NULL;
708-
DefElem*downer=NULL;
709-
DefElem*dtemplate=NULL;
710-
DefElem*dencoding=NULL;
711-
DefElem*dlocale=NULL;
712-
DefElem*dbuiltinlocale=NULL;
713-
DefElem*dcollate=NULL;
714-
DefElem*dctype=NULL;
715-
DefElem*diculocale=NULL;
716-
DefElem*dicurules=NULL;
717-
DefElem*dlocprovider=NULL;
718-
DefElem*distemplate=NULL;
719-
DefElem*dallowconnections=NULL;
720-
DefElem*dconnlimit=NULL;
721-
DefElem*dcollversion=NULL;
722-
DefElem*dstrategy=NULL;
707+
DefElem*tablespacenameEl=NULL;
708+
DefElem*ownerEl=NULL;
709+
DefElem*templateEl=NULL;
710+
DefElem*encodingEl=NULL;
711+
DefElem*localeEl=NULL;
712+
DefElem*builtinlocaleEl=NULL;
713+
DefElem*collateEl=NULL;
714+
DefElem*ctypeEl=NULL;
715+
DefElem*iculocaleEl=NULL;
716+
DefElem*icurulesEl=NULL;
717+
DefElem*locproviderEl=NULL;
718+
DefElem*istemplateEl=NULL;
719+
DefElem*allowconnectionsEl=NULL;
720+
DefElem*connlimitEl=NULL;
721+
DefElem*collversionEl=NULL;
722+
DefElem*strategyEl=NULL;
723723
char*dbname=stmt->dbname;
724724
char*dbowner=NULL;
725725
constchar*dbtemplate=NULL;
@@ -746,93 +746,93 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
746746

747747
if (strcmp(defel->defname,"tablespace")==0)
748748
{
749-
if (dtablespacename)
749+
if (tablespacenameEl)
750750
errorConflictingDefElem(defel,pstate);
751-
dtablespacename=defel;
751+
tablespacenameEl=defel;
752752
}
753753
elseif (strcmp(defel->defname,"owner")==0)
754754
{
755-
if (downer)
755+
if (ownerEl)
756756
errorConflictingDefElem(defel,pstate);
757-
downer=defel;
757+
ownerEl=defel;
758758
}
759759
elseif (strcmp(defel->defname,"template")==0)
760760
{
761-
if (dtemplate)
761+
if (templateEl)
762762
errorConflictingDefElem(defel,pstate);
763-
dtemplate=defel;
763+
templateEl=defel;
764764
}
765765
elseif (strcmp(defel->defname,"encoding")==0)
766766
{
767-
if (dencoding)
767+
if (encodingEl)
768768
errorConflictingDefElem(defel,pstate);
769-
dencoding=defel;
769+
encodingEl=defel;
770770
}
771771
elseif (strcmp(defel->defname,"locale")==0)
772772
{
773-
if (dlocale)
773+
if (localeEl)
774774
errorConflictingDefElem(defel,pstate);
775-
dlocale=defel;
775+
localeEl=defel;
776776
}
777777
elseif (strcmp(defel->defname,"builtin_locale")==0)
778778
{
779-
if (dbuiltinlocale)
779+
if (builtinlocaleEl)
780780
errorConflictingDefElem(defel,pstate);
781-
dbuiltinlocale=defel;
781+
builtinlocaleEl=defel;
782782
}
783783
elseif (strcmp(defel->defname,"lc_collate")==0)
784784
{
785-
if (dcollate)
785+
if (collateEl)
786786
errorConflictingDefElem(defel,pstate);
787-
dcollate=defel;
787+
collateEl=defel;
788788
}
789789
elseif (strcmp(defel->defname,"lc_ctype")==0)
790790
{
791-
if (dctype)
791+
if (ctypeEl)
792792
errorConflictingDefElem(defel,pstate);
793-
dctype=defel;
793+
ctypeEl=defel;
794794
}
795795
elseif (strcmp(defel->defname,"icu_locale")==0)
796796
{
797-
if (diculocale)
797+
if (iculocaleEl)
798798
errorConflictingDefElem(defel,pstate);
799-
diculocale=defel;
799+
iculocaleEl=defel;
800800
}
801801
elseif (strcmp(defel->defname,"icu_rules")==0)
802802
{
803-
if (dicurules)
803+
if (icurulesEl)
804804
errorConflictingDefElem(defel,pstate);
805-
dicurules=defel;
805+
icurulesEl=defel;
806806
}
807807
elseif (strcmp(defel->defname,"locale_provider")==0)
808808
{
809-
if (dlocprovider)
809+
if (locproviderEl)
810810
errorConflictingDefElem(defel,pstate);
811-
dlocprovider=defel;
811+
locproviderEl=defel;
812812
}
813813
elseif (strcmp(defel->defname,"is_template")==0)
814814
{
815-
if (distemplate)
815+
if (istemplateEl)
816816
errorConflictingDefElem(defel,pstate);
817-
distemplate=defel;
817+
istemplateEl=defel;
818818
}
819819
elseif (strcmp(defel->defname,"allow_connections")==0)
820820
{
821-
if (dallowconnections)
821+
if (allowconnectionsEl)
822822
errorConflictingDefElem(defel,pstate);
823-
dallowconnections=defel;
823+
allowconnectionsEl=defel;
824824
}
825825
elseif (strcmp(defel->defname,"connection_limit")==0)
826826
{
827-
if (dconnlimit)
827+
if (connlimitEl)
828828
errorConflictingDefElem(defel,pstate);
829-
dconnlimit=defel;
829+
connlimitEl=defel;
830830
}
831831
elseif (strcmp(defel->defname,"collation_version")==0)
832832
{
833-
if (dcollversion)
833+
if (collversionEl)
834834
errorConflictingDefElem(defel,pstate);
835-
dcollversion=defel;
835+
collversionEl=defel;
836836
}
837837
elseif (strcmp(defel->defname,"location")==0)
838838
{
@@ -868,9 +868,9 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
868868
}
869869
elseif (strcmp(defel->defname,"strategy")==0)
870870
{
871-
if (dstrategy)
871+
if (strategyEl)
872872
errorConflictingDefElem(defel,pstate);
873-
dstrategy=defel;
873+
strategyEl=defel;
874874
}
875875
else
876876
ereport(ERROR,
@@ -879,57 +879,57 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
879879
parser_errposition(pstate,defel->location)));
880880
}
881881

882-
if (downer&&downer->arg)
883-
dbowner=defGetString(downer);
884-
if (dtemplate&&dtemplate->arg)
885-
dbtemplate=defGetString(dtemplate);
886-
if (dencoding&&dencoding->arg)
882+
if (ownerEl&&ownerEl->arg)
883+
dbowner=defGetString(ownerEl);
884+
if (templateEl&&templateEl->arg)
885+
dbtemplate=defGetString(templateEl);
886+
if (encodingEl&&encodingEl->arg)
887887
{
888888
constchar*encoding_name;
889889

890-
if (IsA(dencoding->arg,Integer))
890+
if (IsA(encodingEl->arg,Integer))
891891
{
892-
encoding=defGetInt32(dencoding);
892+
encoding=defGetInt32(encodingEl);
893893
encoding_name=pg_encoding_to_char(encoding);
894894
if (strcmp(encoding_name,"")==0||
895895
pg_valid_server_encoding(encoding_name)<0)
896896
ereport(ERROR,
897897
(errcode(ERRCODE_UNDEFINED_OBJECT),
898898
errmsg("%d is not a valid encoding code",
899899
encoding),
900-
parser_errposition(pstate,dencoding->location)));
900+
parser_errposition(pstate,encodingEl->location)));
901901
}
902902
else
903903
{
904-
encoding_name=defGetString(dencoding);
904+
encoding_name=defGetString(encodingEl);
905905
encoding=pg_valid_server_encoding(encoding_name);
906906
if (encoding<0)
907907
ereport(ERROR,
908908
(errcode(ERRCODE_UNDEFINED_OBJECT),
909909
errmsg("%s is not a valid encoding name",
910910
encoding_name),
911-
parser_errposition(pstate,dencoding->location)));
911+
parser_errposition(pstate,encodingEl->location)));
912912
}
913913
}
914-
if (dlocale&&dlocale->arg)
914+
if (localeEl&&localeEl->arg)
915915
{
916-
dbcollate=defGetString(dlocale);
917-
dbctype=defGetString(dlocale);
918-
dblocale=defGetString(dlocale);
916+
dbcollate=defGetString(localeEl);
917+
dbctype=defGetString(localeEl);
918+
dblocale=defGetString(localeEl);
919919
}
920-
if (dbuiltinlocale&&dbuiltinlocale->arg)
921-
dblocale=defGetString(dbuiltinlocale);
922-
if (dcollate&&dcollate->arg)
923-
dbcollate=defGetString(dcollate);
924-
if (dctype&&dctype->arg)
925-
dbctype=defGetString(dctype);
926-
if (diculocale&&diculocale->arg)
927-
dblocale=defGetString(diculocale);
928-
if (dicurules&&dicurules->arg)
929-
dbicurules=defGetString(dicurules);
930-
if (dlocprovider&&dlocprovider->arg)
920+
if (builtinlocaleEl&&builtinlocaleEl->arg)
921+
dblocale=defGetString(builtinlocaleEl);
922+
if (collateEl&&collateEl->arg)
923+
dbcollate=defGetString(collateEl);
924+
if (ctypeEl&&ctypeEl->arg)
925+
dbctype=defGetString(ctypeEl);
926+
if (iculocaleEl&&iculocaleEl->arg)
927+
dblocale=defGetString(iculocaleEl);
928+
if (icurulesEl&&icurulesEl->arg)
929+
dbicurules=defGetString(icurulesEl);
930+
if (locproviderEl&&locproviderEl->arg)
931931
{
932-
char*locproviderstr=defGetString(dlocprovider);
932+
char*locproviderstr=defGetString(locproviderEl);
933933

934934
if (pg_strcasecmp(locproviderstr,"builtin")==0)
935935
dblocprovider=COLLPROVIDER_BUILTIN;
@@ -943,20 +943,20 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
943943
errmsg("unrecognized locale provider: %s",
944944
locproviderstr)));
945945
}
946-
if (distemplate&&distemplate->arg)
947-
dbistemplate=defGetBoolean(distemplate);
948-
if (dallowconnections&&dallowconnections->arg)
949-
dballowconnections=defGetBoolean(dallowconnections);
950-
if (dconnlimit&&dconnlimit->arg)
946+
if (istemplateEl&&istemplateEl->arg)
947+
dbistemplate=defGetBoolean(istemplateEl);
948+
if (allowconnectionsEl&&allowconnectionsEl->arg)
949+
dballowconnections=defGetBoolean(allowconnectionsEl);
950+
if (connlimitEl&&connlimitEl->arg)
951951
{
952-
dbconnlimit=defGetInt32(dconnlimit);
952+
dbconnlimit=defGetInt32(connlimitEl);
953953
if (dbconnlimit<DATCONNLIMIT_UNLIMITED)
954954
ereport(ERROR,
955955
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
956956
errmsg("invalid connection limit: %d",dbconnlimit)));
957957
}
958-
if (dcollversion)
959-
dbcollversion=defGetString(dcollversion);
958+
if (collversionEl)
959+
dbcollversion=defGetString(collversionEl);
960960

961961
/* obtain OID of proposed owner */
962962
if (dbowner)
@@ -1025,11 +1025,11 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
10251025
}
10261026

10271027
/* Validate the database creation strategy. */
1028-
if (dstrategy&&dstrategy->arg)
1028+
if (strategyEl&&strategyEl->arg)
10291029
{
10301030
char*strategy;
10311031

1032-
strategy=defGetString(dstrategy);
1032+
strategy=defGetString(strategyEl);
10331033
if (pg_strcasecmp(strategy,"wal_log")==0)
10341034
dbstrategy=CREATEDB_WAL_LOG;
10351035
elseif (pg_strcasecmp(strategy,"file_copy")==0)
@@ -1080,15 +1080,15 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
10801080
/* validate provider-specific parameters */
10811081
if (dblocprovider!=COLLPROVIDER_BUILTIN)
10821082
{
1083-
if (dbuiltinlocale)
1083+
if (builtinlocaleEl)
10841084
ereport(ERROR,
10851085
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
10861086
errmsg("BUILTIN_LOCALE cannot be specified unless locale provider is builtin")));
10871087
}
10881088

10891089
if (dblocprovider!=COLLPROVIDER_ICU)
10901090
{
1091-
if (diculocale)
1091+
if (iculocaleEl)
10921092
ereport(ERROR,
10931093
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
10941094
errmsg("ICU locale cannot be specified unless locale provider is ICU")));
@@ -1239,7 +1239,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
12391239
* template0, for which we stipulate that it does not contain
12401240
* collation-using objects.)
12411241
*/
1242-
if (src_collversion&& !dcollversion)
1242+
if (src_collversion&& !collversionEl)
12431243
{
12441244
char*actual_versionstr;
12451245
constchar*locale;
@@ -1289,12 +1289,12 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
12891289
}
12901290

12911291
/* Resolve default tablespace for new database */
1292-
if (dtablespacename&&dtablespacename->arg)
1292+
if (tablespacenameEl&&tablespacenameEl->arg)
12931293
{
12941294
char*tablespacename;
12951295
AclResultaclresult;
12961296

1297-
tablespacename=defGetString(dtablespacename);
1297+
tablespacename=defGetString(tablespacenameEl);
12981298
dst_deftablespace=get_tablespace_oid(tablespacename, false);
12991299
/* check permissions */
13001300
aclresult=object_aclcheck(TableSpaceRelationId,dst_deftablespace,GetUserId(),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp