Pg: Be more strict with boolean bind parameters
Reason for this is that, with FU::SQL, it's possible to accidentally introduce a bind parameter when a WHERE clause was intended (i.e. "WHERE $1"). That's pretty bad, but can easily be caught by simply not accepting *every* possible value as boolean.
This commit is contained in:
parent
02b1dcc328
commit
a7868f74bf
3 changed files with 26 additions and 8 deletions
13
t/pgtypes.t
13
t/pgtypes.t
|
|
@ -61,8 +61,17 @@ sub f($type, $p_in) {
|
|||
$array->[0] = 0;
|
||||
}
|
||||
|
||||
v bool => true, undef, 1, 't';
|
||||
v bool => false, undef, 0, 'f';
|
||||
v bool => true, true, 1, 't';
|
||||
v bool => \1, true, 1, 't';
|
||||
v bool => 1, true, 1, 't';
|
||||
v bool => 't', true, 1, 't';
|
||||
v bool => false, false, 0, 'f';
|
||||
v bool => \0, false, 0, 'f';
|
||||
v bool => 0, false, 0, 'f';
|
||||
v bool => '', false, 0, 'f';
|
||||
v bool => 'f', false, 0, 'f';
|
||||
f bool => 2;
|
||||
f bool => [];
|
||||
|
||||
v int2 => $_ for (1, -1, -32768, 32767, '12345', -12345, 123.0);
|
||||
f int2 => $_ for (-32769, 32768, [], '', 'a', 1.5);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue