From: Sandro Santilli Date: Thu, 15 Dec 2011 23:29:39 +0000 (+0000) Subject: Allow calling geography_in with less than 3 args (see #1320) X-Git-Tag: 2.0.0alpha1~441 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62ec1d1e2248d9ea4938de830c0bbde380d44a7f;p=postgis Allow calling geography_in with less than 3 args (see #1320) git-svn-id: http://svn.osgeo.org/postgis/trunk@8432 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/geography_inout.c b/postgis/geography_inout.c index 28af7c37c..bcd80d5a5 100644 --- a/postgis/geography_inout.c +++ b/postgis/geography_inout.c @@ -82,11 +82,15 @@ Datum geography_in(PG_FUNCTION_ARGS) { char *str = PG_GETARG_CSTRING(0); /* Datum geog_oid = PG_GETARG_OID(1); Not needed. */ - int32 geog_typmod = PG_GETARG_INT32(2); + int32 geog_typmod = -1; LWGEOM_PARSER_RESULT lwg_parser_result; LWGEOM *lwgeom = NULL; GSERIALIZED *g_ser = NULL; + if ( (PG_NARGS()>2) && (!PG_ARGISNULL(2)) ) { + geog_typmod = PG_GETARG_INT32(2); + } + lwgeom_parser_result_init(&lwg_parser_result); /* Empty string. */