aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/misc
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-11-17 22:14:56 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-11-17 22:14:56 +0000
commitcecb6075594a407b7adcd9c9a0c243ca4b43c9a3 (patch)
treed3febb775476b082255aa6122b0ba80a8ba79b37 /src/backend/utils/misc
parentc859308aba7edef428994e6de90ff35f35a328c5 (diff)
downloadpostgresql-cecb6075594a407b7adcd9c9a0c243ca4b43c9a3.tar.gz
postgresql-cecb6075594a407b7adcd9c9a0c243ca4b43c9a3.zip
Make SQL arrays support null elements. This commit fixes the core array
functionality, but I still need to make another pass looking at places that incidentally use arrays (such as ACL manipulation) to make sure they are null-safe. Contrib needs work too. I have not changed the behaviors that are still under discussion about array comparison and what to do with lower bounds.
Diffstat (limited to 'src/backend/utils/misc')
-rw-r--r--src/backend/utils/misc/guc.c24
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample5
2 files changed, 19 insertions, 10 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 79e162efc02..6b83f363217 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.299 2005/11/04 23:50:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.300 2005/11/17 22:14:54 tgl Exp $
*
*--------------------------------------------------------------------
*/
@@ -877,6 +877,16 @@ static struct config_bool ConfigureNamesBool[] =
true, NULL, NULL
},
{
+ {"array_nulls", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
+ gettext_noop("Enable input of NULL elements in arrays."),
+ gettext_noop("When turned on, unquoted NULL in an array input "
+ "value means a NULL value; "
+ "otherwise it is taken literally.")
+ },
+ &Array_nulls,
+ true, NULL, NULL
+ },
+ {
{"default_with_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
gettext_noop("Create new tables with OIDs by default."),
NULL
@@ -5383,14 +5393,13 @@ GUCArrayAdd(ArrayType *array, const char *name, const char *value)
}
}
- isnull = false;
a = array_set(array, 1, &index,
datum,
- -1 /* varlenarray */ ,
+ false,
+ -1 /* varlena array */ ,
-1 /* TEXT's typlen */ ,
false /* TEXT's typbyval */ ,
- 'i' /* TEXT's typalign */ ,
- &isnull);
+ 'i' /* TEXT's typalign */ );
}
else
a = construct_array(&datum, 1,
@@ -5456,14 +5465,13 @@ GUCArrayDelete(ArrayType *array, const char *name)
/* else add it to the output array */
if (newarray)
{
- isnull = false;
newarray = array_set(newarray, 1, &index,
d,
+ false,
-1 /* varlenarray */ ,
-1 /* TEXT's typlen */ ,
false /* TEXT's typbyval */ ,
- 'i' /* TEXT's typalign */ ,
- &isnull);
+ 'i' /* TEXT's typalign */ );
}
else
newarray = construct_array(&d, 1,
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 773899e8b77..94503ddfbb2 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -413,10 +413,11 @@
# - Previous Postgres Versions -
#add_missing_from = off
-#regex_flavor = advanced # advanced, extended, or basic
-#sql_inheritance = on
+#array_nulls = on
#default_with_oids = off
#escape_string_warning = off
+#regex_flavor = advanced # advanced, extended, or basic
+#sql_inheritance = on
# - Other Platforms & Clients -