@@ -704,22 +704,22 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
704
704
Oid dboid = InvalidOid ;
705
705
Oid datdba ;
706
706
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 ;
723
723
char * dbname = stmt -> dbname ;
724
724
char * dbowner = NULL ;
725
725
const char * dbtemplate = NULL ;
@@ -746,93 +746,93 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
746
746
747
747
if (strcmp (defel -> defname , "tablespace" ) == 0 )
748
748
{
749
- if (dtablespacename )
749
+ if (tablespacenameEl )
750
750
errorConflictingDefElem (defel , pstate );
751
- dtablespacename = defel ;
751
+ tablespacenameEl = defel ;
752
752
}
753
753
else if (strcmp (defel -> defname , "owner" ) == 0 )
754
754
{
755
- if (downer )
755
+ if (ownerEl )
756
756
errorConflictingDefElem (defel , pstate );
757
- downer = defel ;
757
+ ownerEl = defel ;
758
758
}
759
759
else if (strcmp (defel -> defname , "template" ) == 0 )
760
760
{
761
- if (dtemplate )
761
+ if (templateEl )
762
762
errorConflictingDefElem (defel , pstate );
763
- dtemplate = defel ;
763
+ templateEl = defel ;
764
764
}
765
765
else if (strcmp (defel -> defname , "encoding" ) == 0 )
766
766
{
767
- if (dencoding )
767
+ if (encodingEl )
768
768
errorConflictingDefElem (defel , pstate );
769
- dencoding = defel ;
769
+ encodingEl = defel ;
770
770
}
771
771
else if (strcmp (defel -> defname , "locale" ) == 0 )
772
772
{
773
- if (dlocale )
773
+ if (localeEl )
774
774
errorConflictingDefElem (defel , pstate );
775
- dlocale = defel ;
775
+ localeEl = defel ;
776
776
}
777
777
else if (strcmp (defel -> defname , "builtin_locale" ) == 0 )
778
778
{
779
- if (dbuiltinlocale )
779
+ if (builtinlocaleEl )
780
780
errorConflictingDefElem (defel , pstate );
781
- dbuiltinlocale = defel ;
781
+ builtinlocaleEl = defel ;
782
782
}
783
783
else if (strcmp (defel -> defname , "lc_collate" ) == 0 )
784
784
{
785
- if (dcollate )
785
+ if (collateEl )
786
786
errorConflictingDefElem (defel , pstate );
787
- dcollate = defel ;
787
+ collateEl = defel ;
788
788
}
789
789
else if (strcmp (defel -> defname , "lc_ctype" ) == 0 )
790
790
{
791
- if (dctype )
791
+ if (ctypeEl )
792
792
errorConflictingDefElem (defel , pstate );
793
- dctype = defel ;
793
+ ctypeEl = defel ;
794
794
}
795
795
else if (strcmp (defel -> defname , "icu_locale" ) == 0 )
796
796
{
797
- if (diculocale )
797
+ if (iculocaleEl )
798
798
errorConflictingDefElem (defel , pstate );
799
- diculocale = defel ;
799
+ iculocaleEl = defel ;
800
800
}
801
801
else if (strcmp (defel -> defname , "icu_rules" ) == 0 )
802
802
{
803
- if (dicurules )
803
+ if (icurulesEl )
804
804
errorConflictingDefElem (defel , pstate );
805
- dicurules = defel ;
805
+ icurulesEl = defel ;
806
806
}
807
807
else if (strcmp (defel -> defname , "locale_provider" ) == 0 )
808
808
{
809
- if (dlocprovider )
809
+ if (locproviderEl )
810
810
errorConflictingDefElem (defel , pstate );
811
- dlocprovider = defel ;
811
+ locproviderEl = defel ;
812
812
}
813
813
else if (strcmp (defel -> defname , "is_template" ) == 0 )
814
814
{
815
- if (distemplate )
815
+ if (istemplateEl )
816
816
errorConflictingDefElem (defel , pstate );
817
- distemplate = defel ;
817
+ istemplateEl = defel ;
818
818
}
819
819
else if (strcmp (defel -> defname , "allow_connections" ) == 0 )
820
820
{
821
- if (dallowconnections )
821
+ if (allowconnectionsEl )
822
822
errorConflictingDefElem (defel , pstate );
823
- dallowconnections = defel ;
823
+ allowconnectionsEl = defel ;
824
824
}
825
825
else if (strcmp (defel -> defname , "connection_limit" ) == 0 )
826
826
{
827
- if (dconnlimit )
827
+ if (connlimitEl )
828
828
errorConflictingDefElem (defel , pstate );
829
- dconnlimit = defel ;
829
+ connlimitEl = defel ;
830
830
}
831
831
else if (strcmp (defel -> defname , "collation_version" ) == 0 )
832
832
{
833
- if (dcollversion )
833
+ if (collversionEl )
834
834
errorConflictingDefElem (defel , pstate );
835
- dcollversion = defel ;
835
+ collversionEl = defel ;
836
836
}
837
837
else if (strcmp (defel -> defname , "location" ) == 0 )
838
838
{
@@ -868,9 +868,9 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
868
868
}
869
869
else if (strcmp (defel -> defname , "strategy" ) == 0 )
870
870
{
871
- if (dstrategy )
871
+ if (strategyEl )
872
872
errorConflictingDefElem (defel , pstate );
873
- dstrategy = defel ;
873
+ strategyEl = defel ;
874
874
}
875
875
else
876
876
ereport (ERROR ,
@@ -879,57 +879,57 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
879
879
parser_errposition (pstate , defel -> location )));
880
880
}
881
881
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 )
887
887
{
888
888
const char * encoding_name ;
889
889
890
- if (IsA (dencoding -> arg , Integer ))
890
+ if (IsA (encodingEl -> arg , Integer ))
891
891
{
892
- encoding = defGetInt32 (dencoding );
892
+ encoding = defGetInt32 (encodingEl );
893
893
encoding_name = pg_encoding_to_char (encoding );
894
894
if (strcmp (encoding_name , "" ) == 0 ||
895
895
pg_valid_server_encoding (encoding_name ) < 0 )
896
896
ereport (ERROR ,
897
897
(errcode (ERRCODE_UNDEFINED_OBJECT ),
898
898
errmsg ("%d is not a valid encoding code" ,
899
899
encoding ),
900
- parser_errposition (pstate , dencoding -> location )));
900
+ parser_errposition (pstate , encodingEl -> location )));
901
901
}
902
902
else
903
903
{
904
- encoding_name = defGetString (dencoding );
904
+ encoding_name = defGetString (encodingEl );
905
905
encoding = pg_valid_server_encoding (encoding_name );
906
906
if (encoding < 0 )
907
907
ereport (ERROR ,
908
908
(errcode (ERRCODE_UNDEFINED_OBJECT ),
909
909
errmsg ("%s is not a valid encoding name" ,
910
910
encoding_name ),
911
- parser_errposition (pstate , dencoding -> location )));
911
+ parser_errposition (pstate , encodingEl -> location )));
912
912
}
913
913
}
914
- if (dlocale && dlocale -> arg )
914
+ if (localeEl && localeEl -> arg )
915
915
{
916
- dbcollate = defGetString (dlocale );
917
- dbctype = defGetString (dlocale );
918
- dblocale = defGetString (dlocale );
916
+ dbcollate = defGetString (localeEl );
917
+ dbctype = defGetString (localeEl );
918
+ dblocale = defGetString (localeEl );
919
919
}
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 )
931
931
{
932
- char * locproviderstr = defGetString (dlocprovider );
932
+ char * locproviderstr = defGetString (locproviderEl );
933
933
934
934
if (pg_strcasecmp (locproviderstr , "builtin" ) == 0 )
935
935
dblocprovider = COLLPROVIDER_BUILTIN ;
@@ -943,20 +943,20 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
943
943
errmsg ("unrecognized locale provider: %s" ,
944
944
locproviderstr )));
945
945
}
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 )
951
951
{
952
- dbconnlimit = defGetInt32 (dconnlimit );
952
+ dbconnlimit = defGetInt32 (connlimitEl );
953
953
if (dbconnlimit < DATCONNLIMIT_UNLIMITED )
954
954
ereport (ERROR ,
955
955
(errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
956
956
errmsg ("invalid connection limit: %d" , dbconnlimit )));
957
957
}
958
- if (dcollversion )
959
- dbcollversion = defGetString (dcollversion );
958
+ if (collversionEl )
959
+ dbcollversion = defGetString (collversionEl );
960
960
961
961
/* obtain OID of proposed owner */
962
962
if (dbowner )
@@ -1025,11 +1025,11 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
1025
1025
}
1026
1026
1027
1027
/* Validate the database creation strategy. */
1028
- if (dstrategy && dstrategy -> arg )
1028
+ if (strategyEl && strategyEl -> arg )
1029
1029
{
1030
1030
char * strategy ;
1031
1031
1032
- strategy = defGetString (dstrategy );
1032
+ strategy = defGetString (strategyEl );
1033
1033
if (pg_strcasecmp (strategy , "wal_log" ) == 0 )
1034
1034
dbstrategy = CREATEDB_WAL_LOG ;
1035
1035
else if (pg_strcasecmp (strategy , "file_copy" ) == 0 )
@@ -1080,15 +1080,15 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
1080
1080
/* validate provider-specific parameters */
1081
1081
if (dblocprovider != COLLPROVIDER_BUILTIN )
1082
1082
{
1083
- if (dbuiltinlocale )
1083
+ if (builtinlocaleEl )
1084
1084
ereport (ERROR ,
1085
1085
(errcode (ERRCODE_INVALID_OBJECT_DEFINITION ),
1086
1086
errmsg ("BUILTIN_LOCALE cannot be specified unless locale provider is builtin" )));
1087
1087
}
1088
1088
1089
1089
if (dblocprovider != COLLPROVIDER_ICU )
1090
1090
{
1091
- if (diculocale )
1091
+ if (iculocaleEl )
1092
1092
ereport (ERROR ,
1093
1093
(errcode (ERRCODE_INVALID_OBJECT_DEFINITION ),
1094
1094
errmsg ("ICU locale cannot be specified unless locale provider is ICU" )));
@@ -1239,7 +1239,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
1239
1239
* template0, for which we stipulate that it does not contain
1240
1240
* collation-using objects.)
1241
1241
*/
1242
- if (src_collversion && !dcollversion )
1242
+ if (src_collversion && !collversionEl )
1243
1243
{
1244
1244
char * actual_versionstr ;
1245
1245
const char * locale ;
@@ -1289,12 +1289,12 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
1289
1289
}
1290
1290
1291
1291
/* Resolve default tablespace for new database */
1292
- if (dtablespacename && dtablespacename -> arg )
1292
+ if (tablespacenameEl && tablespacenameEl -> arg )
1293
1293
{
1294
1294
char * tablespacename ;
1295
1295
AclResult aclresult ;
1296
1296
1297
- tablespacename = defGetString (dtablespacename );
1297
+ tablespacename = defGetString (tablespacenameEl );
1298
1298
dst_deftablespace = get_tablespace_oid (tablespacename , false);
1299
1299
/* check permissions */
1300
1300
aclresult = object_aclcheck (TableSpaceRelationId , dst_deftablespace , GetUserId (),
0 commit comments