nekokak/p5-Teng — pull request #118 by astj (2013-09-23 08:23:11+00:00)
Title: Fix/xt postgres (Still fails some tests)

"xt" test with Pg is broken, so I fixed some of (not all of) them.

Though still some tests fail with Pg, I left them because they are worth to notice.

Now most of tests pass.
```
$ prove -l -It/lib -It/ xt/postgresql/

...

Test Summary Report
-------------------
xt/postgresql/common.t (Wstat: 0 Tests: 24 Failed: 2)
Failed tests: 2-3
Files=3, Tests=39, 27 wallclock secs ( 0.06 usr 0.01 sys + 4.18 cusr 2.16 csys = 6.41 CPU)
Result: FAIL
```

Following tests still fails:
* `t/002_common/001_insert.t` via `xt/postgresql/common.t`
```
DBD::Pg::db last_insert_id failed: ERROR: currval of sequence "mock_basic_id_seq" is not yet defined in this session at /Users/asato/p5-Teng/lib/Teng.pm line 289.

# Failed test at ./t/002_common/001_insert.t line 43.
# got: undef
# expected: '3'
# Looks like you failed 1 test of 1.

# Failed test 'fast_insert'
# at ./t/002_common/001_insert.t line 44.
# Looks like you failed 1 test of 4.
```
As this test shows, Teng+DBD::Pg cannot return right last_insert_id when (sequential) primary key is given as `fast_insert`'s argument.
This is DBD::Pg (and PostgreSQL itself)'s limitation.
It's possible to skip this test when driver is Pg to make `001_insert.t` pass, but I think this behavior should be documented first, so I left it.
(If I should write document and fix this test, please tell me.)

* `t/002_common/002_update.t` via `xt/postgresql/common.t`
```
DBD::Pg::st execute failed: ERROR: operator does not exist: text + integer
LINE 1: UPDATE "mock_basic" SET "name" = name + 1 WHERE ("id" = $1)
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. at /Users/asato/p5-Teng/lib/Teng.pm line 272.

# Failed test at ./t/002_common/002_update.t line 74.
# got: '1'
# expected: '2'
# Looks like you failed 1 test of 4.

# Failed test 'scalarref update'
# at ./t/002_common/002_update.t line 75.
# Looks like you failed 1 test of 9.
```
As this test shows, Pg cannot operate (column value)+integer when column type is text. (Mysql can do it when column value is capable to cast into numeric value.)
Because this test is completely driver dependent and is not so important, I think this test should be removed (but not removed yet).

と下手な英語で書いたのですが、もし日本語で書いた方がまどろっこしくなくてよくないのでしたらそうします。