CFLAGS=-Wall -O0 -g
OBJS=main.o \
+ $(topsrc_dir)/strlcpy.o \
$(topsrc_dir)/pool_timestamp.o \
$(topsrc_dir)/parser/libsql-parser.a
all-pre:
$(MAKE) -C $(topsrc_dir)/parser
+ $(MAKE) -C $(topsrc_dir) strlcpy.o
$(MAKE) -C $(topsrc_dir) pool_timestamp.o
$(PROGRAM): $(OBJS)
INSERT INTO "rel1" VALUES (DEFAULT,'2009-01-01 23:59:59.123456+09',DEFAULT,'2009-01-01 23:59:59.123456+09')
INSERT INTO rel2 DEFAULT VALUES
INSERT INTO rel2(c1) VALUES(1)
-INSERT INTO "rel1" VALUES (1,"timestamptz"('2009-01-01 23:59:59.123456+09'::text),2,'2009-01-01 23:59:59.123456+09'::text::date)
-INSERT INTO "rel1" VALUES (3,"timestamptz"('2009-01-01 23:59:59.123456+09'::text),4,'2009-01-01 23:59:59.123456+09'::text::timetz)
+INSERT INTO "rel1" VALUES (1,"pg_catalog"."timestamptz"('2009-01-01 23:59:59.123456+09'::text),2,'2009-01-01 23:59:59.123456+09'::text::date)
+INSERT INTO "rel1" VALUES (3,"pg_catalog"."timestamptz"('2009-01-01 23:59:59.123456+09'::text),4,'2009-01-01 23:59:59.123456+09'::text::timetz)
INSERT INTO "rel1" VALUES (5,'2009-01-01 23:59:59.123456+09'::text::timestamptz(0),6,'2009-01-01 23:59:59.123456+09'::text::timetz(0))
INSERT INTO "rel1" VALUES (7,'2009-01-01 23:59:59.123456+09'::text::timestamp,8,'2009-01-01 23:59:59.123456+09'::text::time)
INSERT INTO "rel1" VALUES (9,'2009-01-01 23:59:59.123456+09'::text::timestamp(0),10,'2009-01-01 23:59:59.123456+09'::text::time(0))
DELETE FROM "rel1" WHERE ("c1"='2009-01-01 23:59:59.123456+09'::text::date )
PREPARE "q" ("date",timestamptz) AS DELETE FROM "rel1" WHERE ( ("c1"=$1 ) AND ("c3"=$2::text::date ))
-EXECUTE "q" ("timestamptz"('2009-01-01 23:59:59.123456+09'::text))
+EXECUTE "q" ("pg_catalog"."timestamptz"('2009-01-01 23:59:59.123456+09'::text))
UPDATE "rel1" SET "c1" = DEFAULT, "c2" = '2009-01-01 23:59:59.123456+09'
UPDATE rel2 SET c1 = DEFAULT, c2 = DEFAULT
-UPDATE "rel1" SET "c1" = "timestamptz"('2009-01-01 23:59:59.123456+09'::text), "c2" = '2009-01-01 23:59:59.123456+09'::text::date
-UPDATE "rel1" SET "c3" = "timestamptz"('2009-01-01 23:59:59.123456+09'::text), "c4" = '2009-01-01 23:59:59.123456+09'::text::timetz
+UPDATE "rel1" SET "c1" = "pg_catalog"."timestamptz"('2009-01-01 23:59:59.123456+09'::text), "c2" = '2009-01-01 23:59:59.123456+09'::text::date
+UPDATE "rel1" SET "c3" = "pg_catalog"."timestamptz"('2009-01-01 23:59:59.123456+09'::text), "c4" = '2009-01-01 23:59:59.123456+09'::text::timetz
UPDATE "rel1" SET "c1" = '2009-01-01 23:59:59.123456+09'::text::timestamp, "c2" = '2009-01-01 23:59:59.123456+09'::text::time
PREPARE "q" (int4,timestamptz) AS UPDATE "rel1" SET "c1" = $1, "c2" = $2::text::date
#include <string.h>
#include <stdio.h>
#include "pool.h"
-#include "pool_proto_modules.h"
+#include "pool_config.h"
+#include "pool_relcache.h"
#include "pool_timestamp.h"
#include "parser/parser.h"
/* for get_current_timestamp() (MASTER() macro) */
POOL_REQUEST_INFO _req_info;
POOL_REQUEST_INFO *Req_info = &_req_info;
-int selected_slot = 0; /* selected DB node */
-int in_load_balance = 1; /* non 0 if in load balance mode */
POOL_CONFIG _pool_config;
POOL_CONFIG *pool_config = &_pool_config;
typedef struct {
- char *attrname;
+ char *attrname; /* attribute name */
+ char *adsrc; /* default value expression */
int use_timestamp;
} TSAttr;
TSRel rc[2] = {
{ 4, {
- { "c1", 0 },
- { "c2", 1 },
- { "c3", 0 },
- { "c4", 1 }
+ { "c1", "", 0 },
+ { "c2", "", 1 },
+ { "c3", "", 0 },
+ { "c4", "", 1 }
} },
{ 4, {
- { "c1", 0 },
- { "c2", 0 },
- { "c3", 0 },
- { "c4", 0 }
+ { "c1", "", 0 },
+ { "c2", "", 0 },
+ { "c3", "", 0 },
+ { "c4", "", 0 }
} }
};
+int pool_virtual_master_db_node_id(void)
+{
+ return 0;
+}
+
+bool pool_has_pgpool_regclass(void)
+{
+ return false;
+}
+
POOL_RELCACHE *
pool_create_relcache(int cachesize, char *sql, func_ptr register_func, func_ptr unregister_func, bool issessionlocal)
{
char *query;
List *tree;
ListCell *l;
- Portal portal;
+ StartupPacket sp;
POOL_CONNECTION_POOL backend;
POOL_CONNECTION_POOL_SLOT slot;
+ POOL_SENT_MESSAGE msg;
backend.slots[0] = &slot;
+ slot.sp = &sp;
pool_config->replication_mode = 1;
{
foreach(l, tree)
{
- portal.num_tsparams = 0;
+ msg.num_tsparams = 0;
Node *node = (Node *) lfirst(l);
- query = rewrite_timestamp(&backend, node, false, &portal);
+ query = rewrite_timestamp(&backend, node, false, &msg);
if (query)
printf("%s\n", query);
else