MySQL cast expressions.

This commit is contained in:
go-jet 2019-07-31 18:43:54 +02:00
parent fcce8d4262
commit 53dbcd9bfc
41 changed files with 1136 additions and 684 deletions

View file

@ -0,0 +1,48 @@
package postgres
import (
"github.com/go-jet/jet"
"testing"
)
var dateVar = Date(2000, 12, 30)
func TestDateExpressionEQ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColDate.EQ(table2ColDate), "(table1.col_date = table2.col_date)")
jet.AssertPostgreClauseSerialize(t, table1ColDate.EQ(dateVar), "(table1.col_date = $1::date)", "2000-12-30")
}
func TestDateExpressionNOT_EQ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColDate.NOT_EQ(table2ColDate), "(table1.col_date != table2.col_date)")
jet.AssertPostgreClauseSerialize(t, table1ColDate.NOT_EQ(dateVar), "(table1.col_date != $1::date)", "2000-12-30")
}
func TestDateExpressionIS_DISTINCT_FROM(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColDate.IS_DISTINCT_FROM(table2ColDate), "(table1.col_date IS DISTINCT FROM table2.col_date)")
jet.AssertPostgreClauseSerialize(t, table1ColDate.IS_DISTINCT_FROM(dateVar), "(table1.col_date IS DISTINCT FROM $1::date)", "2000-12-30")
}
func TestDateExpressionIS_NOT_DISTINCT_FROM(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColDate.IS_NOT_DISTINCT_FROM(table2ColDate), "(table1.col_date IS NOT DISTINCT FROM table2.col_date)")
jet.AssertPostgreClauseSerialize(t, table1ColDate.IS_NOT_DISTINCT_FROM(dateVar), "(table1.col_date IS NOT DISTINCT FROM $1::date)", "2000-12-30")
}
func TestDateExpressionGT(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColDate.GT(table2ColDate), "(table1.col_date > table2.col_date)")
jet.AssertPostgreClauseSerialize(t, table1ColDate.GT(dateVar), "(table1.col_date > $1::date)", "2000-12-30")
}
func TestDateExpressionGT_EQ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColDate.GT_EQ(table2ColDate), "(table1.col_date >= table2.col_date)")
jet.AssertPostgreClauseSerialize(t, table1ColDate.GT_EQ(dateVar), "(table1.col_date >= $1::date)", "2000-12-30")
}
func TestDateExpressionLT(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColDate.LT(table2ColDate), "(table1.col_date < table2.col_date)")
jet.AssertPostgreClauseSerialize(t, table1ColDate.LT(dateVar), "(table1.col_date < $1::date)", "2000-12-30")
}
func TestDateExpressionLT_EQ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColDate.LT_EQ(table2ColDate), "(table1.col_date <= table2.col_date)")
jet.AssertPostgreClauseSerialize(t, table1ColDate.LT_EQ(dateVar), "(table1.col_date <= $1::date)", "2000-12-30")
}

124
postgres/postgres_cast.go Normal file
View file

@ -0,0 +1,124 @@
package postgres
import (
"fmt"
"github.com/go-jet/jet"
)
type cast interface {
// Cast expression AS bool type
AS_BOOL() BoolExpression
// Cast expression AS smallint type
AS_SMALLINT() IntegerExpression
// Cast expression AS integer type
AS_INTEGER() IntegerExpression
// Cast expression AS bigint type
AS_BIGINT() IntegerExpression
// Cast expression AS numeric type, using precision and optionally scale
AS_NUMERIC(precision int, scale ...int) FloatExpression
// Cast expression AS numeric type, using precision and optionally scale
AS_DECIMAL() FloatExpression
// Cast expression AS real type
AS_REAL() FloatExpression
// Cast expression AS double precision type
AS_DOUBLE() FloatExpression
// Cast expression AS text type
AS_TEXT() StringExpression
// Cast expression AS date type
AS_DATE() DateExpression
// Cast expression AS time type
AS_TIME() TimeExpression
// Cast expression AS time with time timezone type
AS_TIMEZ() TimezExpression
// Cast expression AS timestamp type
AS_TIMESTAMP() TimestampExpression
// Cast expression AS timestamp with timezone type
AS_TIMESTAMPZ() TimestampzExpression
}
type castImpl struct {
jet.Cast
}
func CAST(expr jet.Expression) cast {
castImpl := &castImpl{}
castImpl.Cast = jet.NewCastImpl(expr)
return castImpl
}
func (b *castImpl) AS_BOOL() BoolExpression {
return jet.BoolExp(b.As("boolean"))
}
func (b *castImpl) AS_SMALLINT() IntegerExpression {
return jet.IntExp(b.As("smallint"))
}
// Cast expression AS integer type
func (b *castImpl) AS_INTEGER() IntegerExpression {
return jet.IntExp(b.As("integer"))
}
// Cast expression AS bigint type
func (b *castImpl) AS_BIGINT() IntegerExpression {
return jet.IntExp(b.As("bigint"))
}
// Cast expression AS numeric type, using precision and optionally scale
func (b *castImpl) AS_NUMERIC(precision int, scale ...int) FloatExpression {
var castType string
if len(scale) > 0 {
castType = fmt.Sprintf("numeric(%d, %d)", precision, scale[0])
} else {
castType = fmt.Sprintf("numeric(%d)", precision)
}
return jet.FloatExp(b.As(jet.CastType(castType)))
}
func (b *castImpl) AS_DECIMAL() FloatExpression {
return jet.FloatExp(b.As("decimal"))
}
// Cast expression AS real type
func (b *castImpl) AS_REAL() FloatExpression {
return jet.FloatExp(b.As("real"))
}
// Cast expression AS double precision type
func (b *castImpl) AS_DOUBLE() FloatExpression {
return jet.FloatExp(b.As("double precision"))
}
// Cast expression AS text type
func (b *castImpl) AS_TEXT() StringExpression {
return jet.StringExp(b.As("text"))
}
// Cast expression AS date type
func (b *castImpl) AS_DATE() DateExpression {
return jet.DateExp(b.As("date"))
}
// Cast expression AS time type
func (b *castImpl) AS_TIME() TimeExpression {
return jet.TimeExp(b.As("time without time zone"))
}
// Cast expression AS time with time timezone type
func (b *castImpl) AS_TIMEZ() TimezExpression {
return jet.TimezExp(b.As("time with time zone"))
}
// Cast expression AS timestamp type
func (b *castImpl) AS_TIMESTAMP() TimestampExpression {
return jet.TimestampExp(b.As("timestamp without time zone"))
}
// Cast expression AS timestamp with timezone type
func (b *castImpl) AS_TIMESTAMPZ() TimestampzExpression {
return jet.TimestampzExp(b.As("timestamp with time zone"))
}

View file

@ -0,0 +1,61 @@
package postgres
import (
"github.com/go-jet/jet"
"testing"
)
func TestExpressionCAST_AS_BOOL(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(Int(1)).AS_BOOL(), "$1::boolean", int64(1))
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_BOOL(), "table2.col3::boolean")
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3.ADD(table2Col3)).AS_BOOL(), "(table2.col3 + table2.col3)::boolean")
}
func TestExpressionCAST_AS_SMALLINT(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_SMALLINT(), "table2.col3::smallint")
}
func TestExpressionCAST_AS_INTEGER(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_INTEGER(), "table2.col3::integer")
}
func TestExpressionCAST_AS_BIGINT(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_BIGINT(), "table2.col3::bigint")
}
func TestExpressionCAST_AS_NUMERIC(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_NUMERIC(11, 11), "table2.col3::numeric(11, 11)")
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_NUMERIC(11), "table2.col3::numeric(11)")
}
func TestExpressionCAST_AS_REAL(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_REAL(), "table2.col3::real")
}
func TestExpressionCAST_AS_DOUBLE(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_DOUBLE(), "table2.col3::double precision")
}
func TestExpressionCAST_AS_TEXT(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_TEXT(), "table2.col3::text")
}
func TestExpressionCAST_AS_DATE(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_DATE(), "table2.col3::date")
}
func TestExpressionCAST_AS_TIME(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_TIME(), "table2.col3::time without time zone")
}
func TestExpressionCAST_AS_TIMEZ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_TIMEZ(), "table2.col3::time with time zone")
}
func TestExpressionCAST_AS_TIMESTAMP(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_TIMESTAMP(), "table2.col3::timestamp without time zone")
}
func TestExpressionCAST_AS_TIMESTAMPZ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, CAST(table2Col3).AS_TIMESTAMPZ(), "table2.col3::timestamp with time zone")
}

View file

@ -0,0 +1,30 @@
package postgres
import (
"github.com/go-jet/jet/internal/testutils"
"testing"
)
func TestSelectLock(t *testing.T) {
testutils.AssertStatementSql(t, SELECT(table1ColBool).FROM(table1).FOR(UPDATE()), `
SELECT table1.col_bool AS "table1.col_bool"
FROM db.table1
FOR UPDATE;
`)
testutils.AssertStatementSql(t, SELECT(table1ColBool).FROM(table1).FOR(SHARE().NOWAIT()), `
SELECT table1.col_bool AS "table1.col_bool"
FROM db.table1
FOR SHARE NOWAIT;
`)
testutils.AssertStatementSql(t, SELECT(table1ColBool).FROM(table1).FOR(KEY_SHARE().NOWAIT()), `
SELECT table1.col_bool AS "table1.col_bool"
FROM db.table1
FOR KEY SHARE NOWAIT;
`)
testutils.AssertStatementSql(t, SELECT(table1ColBool).FROM(table1).FOR(NO_KEY_UPDATE().SKIP_LOCKED()), `
SELECT table1.col_bool AS "table1.col_bool"
FROM db.table1
FOR NO KEY UPDATE SKIP LOCKED;
`)
}

View file

@ -3,37 +3,102 @@ package postgres
import "github.com/go-jet/jet"
type ColumnBool jet.ColumnBool
type BoolExpression jet.BoolExpression
var BoolColumn = jet.BoolColumn
var Bool = jet.Bool
type ColumnString jet.ColumnString
type StringExpression jet.StringExpression
var StringColumn = jet.StringColumn
var String = jet.String
type ColumnInteger jet.ColumnInteger
type IntegerExpression jet.IntegerExpression
var IntegerColumn = jet.IntegerColumn
var Int = jet.Int
type ColumnFloat jet.ColumnFloat
type FloatExpression jet.FloatExpression
var FloatColumn = jet.FloatColumn
var Float = jet.Float
var FloatExp = jet.FloatExp
type ColumnDate jet.ColumnDate
type DateExpression jet.DateExpression
var DateColumn = jet.DateColumn
var Date = func(year, month, day int) DateExpression {
return CAST(jet.Date(year, month, day)).AS_DATE()
}
type ColumnDateTime jet.ColumnTimestamp
type DateTimeExpression jet.TimestampExpression
var DateTimeColumn = jet.TimestampColumn
var DateTime = func(year, month, day int) DateExpression {
return CAST(jet.Date(year, month, day)).AS_DATE()
}
type TimeExpression jet.TimeExpression
type ColumnTime jet.ColumnTime
var TimeColumn = jet.TimeColumn
var Time = func(hour, minute, second, milliseconds int) TimeExpression {
return CAST(jet.Time(hour, minute, second, milliseconds)).AS_TIME()
}
var TimeExp = jet.TimeExp
type ColumnTimestamp jet.ColumnTimestamp
var TimestampColumn = jet.TimestampColumn
type TimezExpression jet.TimezExpression
type ColumnTimez jet.ColumnTimez
var TimezColumn = jet.TimezColumn
type ColumnTimestamp jet.ColumnTimestamp
type TimestampExpression jet.TimestampExpression
var TimestampColumn = jet.TimestampColumn
var Timestamp = func(year, month, day, hour, minute, second, milliseconds int) TimestampExpression {
return CAST(jet.Timestamp(year, month, day, hour, minute, second, milliseconds)).AS_TIMESTAMP()
}
var TimestampExp = jet.TimestampExp
type TimestampzExpression jet.TimestampzExpression
type ColumnTimestampz jet.ColumnTimestampz
var TimestampzColumn = jet.TimestampzColumn
// ---------------- functions ------------------//
var MAXf = jet.MAXf
var SUMf = jet.SUMf
var AVG = jet.AVG
var MINf = jet.MINf
var COUNT = jet.COUNT
var CASE = jet.CASE
// ---------------- statements -----------------//
type SelectStatement jet.SelectStatement
var SELECT = jet.SELECT
var UNION = jet.UNION
var UNION_ALL = jet.UNION_ALL
var INTERSECT = jet.INTERSECT
var INTERSECT_ALL = jet.INTERSECT_ALL
type SelectLock jet.SelectLock
var (
UPDATE = jet.NewSelectLock("UPDATE")
NO_KEY_UPDATE = jet.NewSelectLock("NO KEY UPDATE")
SHARE = jet.NewSelectLock("SHARE")
KEY_SHARE = jet.NewSelectLock("KEY SHARE")
)
var STAR = jet.STAR

72
postgres/testutils.go Normal file
View file

@ -0,0 +1,72 @@
package postgres
import (
"github.com/go-jet/jet"
)
var table1Col1 = IntegerColumn("col1")
var table1ColInt = IntegerColumn("col_int")
var table1ColFloat = FloatColumn("col_float")
var table1Col3 = IntegerColumn("col3")
var table1ColTime = TimeColumn("col_time")
var table1ColTimez = TimezColumn("col_timez")
var table1ColTimestamp = TimestampColumn("col_timestamp")
var table1ColTimestampz = TimestampzColumn("col_timestampz")
var table1ColBool = BoolColumn("col_bool")
var table1ColDate = DateColumn("col_date")
var table1 = jet.NewTable(
jet.PostgreSQL,
"db",
"table1",
table1Col1,
table1ColInt,
table1ColFloat,
table1Col3,
table1ColTime,
table1ColTimez,
table1ColBool,
table1ColDate,
table1ColTimestamp,
table1ColTimestampz,
)
var table2Col3 = IntegerColumn("col3")
var table2Col4 = IntegerColumn("col4")
var table2ColInt = IntegerColumn("col_int")
var table2ColFloat = FloatColumn("col_float")
var table2ColStr = StringColumn("col_str")
var table2ColBool = BoolColumn("col_bool")
var table2ColTime = TimeColumn("col_time")
var table2ColTimez = TimezColumn("col_timez")
var table2ColTimestamp = TimestampColumn("col_timestamp")
var table2ColTimestampz = TimestampzColumn("col_timestampz")
var table2ColDate = DateColumn("col_date")
var table2 = jet.NewTable(
jet.PostgreSQL,
"db",
"table2",
table2Col3,
table2Col4,
table2ColInt,
table2ColFloat,
table2ColStr,
table2ColBool,
table2ColTime,
table2ColTimez,
table2ColDate,
table2ColTimestamp,
table2ColTimestampz,
)
var table3Col1 = IntegerColumn("col1")
var table3ColInt = IntegerColumn("col_int")
var table3StrCol = StringColumn("col2")
var table3 = jet.NewTable(
jet.PostgreSQL,
"db",
"table3",
table3Col1,
table3ColInt,
table3StrCol)

View file

@ -0,0 +1,54 @@
package postgres
import (
"github.com/go-jet/jet"
"testing"
)
var timeVar = Time(10, 20, 0, 0)
func TestTimeExpressionEQ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTime.EQ(table2ColTime), "(table1.col_time = table2.col_time)")
jet.AssertPostgreClauseSerialize(t, table1ColTime.EQ(timeVar), "(table1.col_time = $1::time without time zone)", "10:20:00.000")
}
func TestTimeExpressionNOT_EQ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTime.NOT_EQ(table2ColTime), "(table1.col_time != table2.col_time)")
jet.AssertPostgreClauseSerialize(t, table1ColTime.NOT_EQ(timeVar), "(table1.col_time != $1::time without time zone)", "10:20:00.000")
}
func TestTimeExpressionIS_DISTINCT_FROM(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTime.IS_DISTINCT_FROM(table2ColTime), "(table1.col_time IS DISTINCT FROM table2.col_time)")
jet.AssertPostgreClauseSerialize(t, table1ColTime.IS_DISTINCT_FROM(timeVar), "(table1.col_time IS DISTINCT FROM $1::time without time zone)", "10:20:00.000")
}
func TestTimeExpressionIS_NOT_DISTINCT_FROM(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTime.IS_NOT_DISTINCT_FROM(table2ColTime), "(table1.col_time IS NOT DISTINCT FROM table2.col_time)")
jet.AssertPostgreClauseSerialize(t, table1ColTime.IS_NOT_DISTINCT_FROM(timeVar), "(table1.col_time IS NOT DISTINCT FROM $1::time without time zone)", "10:20:00.000")
}
func TestTimeExpressionLT(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTime.LT(table2ColTime), "(table1.col_time < table2.col_time)")
jet.AssertPostgreClauseSerialize(t, table1ColTime.LT(timeVar), "(table1.col_time < $1::time without time zone)", "10:20:00.000")
}
func TestTimeExpressionLT_EQ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTime.LT_EQ(table2ColTime), "(table1.col_time <= table2.col_time)")
jet.AssertPostgreClauseSerialize(t, table1ColTime.LT_EQ(timeVar), "(table1.col_time <= $1::time without time zone)", "10:20:00.000")
}
func TestTimeExpressionGT(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTime.GT(table2ColTime), "(table1.col_time > table2.col_time)")
jet.AssertPostgreClauseSerialize(t, table1ColTime.GT(timeVar), "(table1.col_time > $1::time without time zone)", "10:20:00.000")
}
func TestTimeExpressionGT_EQ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTime.GT_EQ(table2ColTime), "(table1.col_time >= table2.col_time)")
jet.AssertPostgreClauseSerialize(t, table1ColTime.GT_EQ(timeVar), "(table1.col_time >= $1::time without time zone)", "10:20:00.000")
}
func TestTimeExp(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, TimeExp(table1ColFloat), "table1.col_float")
jet.AssertPostgreClauseSerialize(t, TimeExp(table1ColFloat).LT(Time(1, 1, 1, 1)),
"(table1.col_float < $1::time without time zone)", string("01:01:01.001"))
}

View file

@ -0,0 +1,55 @@
package postgres
import (
"github.com/go-jet/jet"
"testing"
)
var timestamp = Timestamp(2000, 1, 31, 10, 20, 0, 0)
func TestTimestampExpressionEQ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.EQ(table2ColTimestamp), "(table1.col_timestamp = table2.col_timestamp)")
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.EQ(timestamp),
"(table1.col_timestamp = $1::timestamp without time zone)", "2000-01-31 10:20:00.000")
}
func TestTimestampExpressionNOT_EQ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.NOT_EQ(table2ColTimestamp), "(table1.col_timestamp != table2.col_timestamp)")
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.NOT_EQ(timestamp), "(table1.col_timestamp != $1::timestamp without time zone)", "2000-01-31 10:20:00.000")
}
func TestTimestampExpressionIS_DISTINCT_FROM(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.IS_DISTINCT_FROM(table2ColTimestamp), "(table1.col_timestamp IS DISTINCT FROM table2.col_timestamp)")
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.IS_DISTINCT_FROM(timestamp), "(table1.col_timestamp IS DISTINCT FROM $1::timestamp without time zone)", "2000-01-31 10:20:00.000")
}
func TestTimestampExpressionIS_NOT_DISTINCT_FROM(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.IS_NOT_DISTINCT_FROM(table2ColTimestamp), "(table1.col_timestamp IS NOT DISTINCT FROM table2.col_timestamp)")
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.IS_NOT_DISTINCT_FROM(timestamp), "(table1.col_timestamp IS NOT DISTINCT FROM $1::timestamp without time zone)", "2000-01-31 10:20:00.000")
}
func TestTimestampExpressionLT(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.LT(table2ColTimestamp), "(table1.col_timestamp < table2.col_timestamp)")
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.LT(timestamp), "(table1.col_timestamp < $1::timestamp without time zone)", "2000-01-31 10:20:00.000")
}
func TestTimestampExpressionLT_EQ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.LT_EQ(table2ColTimestamp), "(table1.col_timestamp <= table2.col_timestamp)")
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.LT_EQ(timestamp), "(table1.col_timestamp <= $1::timestamp without time zone)", "2000-01-31 10:20:00.000")
}
func TestTimestampExpressionGT(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.GT(table2ColTimestamp), "(table1.col_timestamp > table2.col_timestamp)")
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.GT(timestamp), "(table1.col_timestamp > $1::timestamp without time zone)", "2000-01-31 10:20:00.000")
}
func TestTimestampExpressionGT_EQ(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.GT_EQ(table2ColTimestamp), "(table1.col_timestamp >= table2.col_timestamp)")
jet.AssertPostgreClauseSerialize(t, table1ColTimestamp.GT_EQ(timestamp), "(table1.col_timestamp >= $1::timestamp without time zone)", "2000-01-31 10:20:00.000")
}
func TestTimestampExp(t *testing.T) {
jet.AssertPostgreClauseSerialize(t, TimestampExp(table1ColFloat), "table1.col_float")
jet.AssertPostgreClauseSerialize(t, TimestampExp(table1ColFloat).LT(timestamp),
"(table1.col_float < $1::timestamp without time zone)", "2000-01-31 10:20:00.000")
}