diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-11-17 22:14:56 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-11-17 22:14:56 +0000 |
commit | cecb6075594a407b7adcd9c9a0c243ca4b43c9a3 (patch) | |
tree | d3febb775476b082255aa6122b0ba80a8ba79b37 /src/backend/utils/misc/guc.c | |
parent | c859308aba7edef428994e6de90ff35f35a328c5 (diff) | |
download | postgresql-cecb6075594a407b7adcd9c9a0c243ca4b43c9a3.tar.gz |
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/guc.c')
-rw-r--r-- | src/backend/utils/misc/guc.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 79e162efc0..6b83f36321 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, |