]> granicus.if.org Git - postgis/commitdiff
Allow calling geography_in with less than 3 args (see #1320)
authorSandro Santilli <strk@keybit.net>
Thu, 15 Dec 2011 23:29:39 +0000 (23:29 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 15 Dec 2011 23:29:39 +0000 (23:29 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8432 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/geography_inout.c

index 28af7c37cac83a4ee82673cfaad1c96e17a3b36f..bcd80d5a5d6ae6b75785326ff0fc54aa7aebd2b1 100644 (file)
@@ -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. */