]> git.openstreetmap.org Git - rails.git/blobdiff - db/functions/xid_to_int4.c
Update polyfills
[rails.git] / db / functions / xid_to_int4.c
index 6863dfaca405de72bfe589e62cdccc5d2afc75ab..e312b5f157cfd36e7013d64fea2293b48ea9fcda 100644 (file)
@@ -1,22 +1,16 @@
-#ifndef USE_MYSQL
-#ifndef USE_PGSQL
-#error One of USE_MYSQL or USE_PGSQL must be defined
-#endif
-#endif
-
-#ifdef USE_PGSQL
-#ifdef USE_MYSQL
-#error ONLY one of USE_MYSQL and USE_PGSQL should be defined
-#endif
-
 #include <postgres.h>
 #include <fmgr.h>
 
-int xid_to_int4(TransactionId xid)
+Datum
+xid_to_int4(PG_FUNCTION_ARGS)
 {
-   return xid;
+   TransactionId xid = PG_GETARG_INT32(0);
+
+   PG_RETURN_INT32(xid);
 }
 
+PG_FUNCTION_INFO_V1(xid_to_int4);
+
 /*
  * To bind this into PGSQL, try something like:
  *
@@ -26,5 +20,3 @@ int xid_to_int4(TransactionId xid)
  *
  * (without all the *s)
  */
-
-#endif