PG_RETURN_POINTER(result);
}
+PG_FUNCTION_INFO_V1(BOOL_to_text);
+Datum BOOL_to_text(PG_FUNCTION_ARGS)
+{
+ bool b = PG_GETARG_BOOL(0);
+ char c;
+ text *result;
+
+ c = b ? 't' : 'f';
+
+ result = palloc(VARHDRSZ+1*sizeof(char));
+ VARATT_SIZEP(result) = VARHDRSZ+1*sizeof(char);
+ memcpy(VARDATA(result), &c, 1*sizeof(char));
+
+ PG_RETURN_POINTER(result);
+
+}
AS '@MODULE_FILENAME@','LWGEOM_to_bytea'
LANGUAGE 'C' _IMMUTABLE_STRICT; -- WITH (isstrict,iscachable);
+CREATEFUNCTION text(bool)
+ RETURNS text
+ AS '@MODULE_FILENAME@','BOOL_to_text'
+ LANGUAGE 'C' _IMMUTABLE_STRICT; -- WITH (isstrict,iscachable);
+
-- 7.3+ explicit casting definitions
#if USE_VERSION >= 73
CREATE CAST (geometry AS box2d) WITH FUNCTION box2d(geometry) AS IMPLICIT;
CREATE CAST (chip AS geometry) WITH FUNCTION geometry(chip) AS IMPLICIT;
CREATE CAST (bytea AS geometry) WITH FUNCTION geometry(bytea) AS IMPLICIT;
CREATE CAST (geometry AS bytea) WITH FUNCTION bytea(geometry) AS IMPLICIT;
+CREATE CAST (bool AS text) WITH FUNCTION text(bool) AS IMPLICIT;
#endif
---------------------------------------------------------------