compoships
compoships copied to clipboard
Invalid input syntax for type uuid
When using a uuid type as primary key, the relationship is made only using the first char and thus returns an input syntax error event when $incrementing
is set as false
and $keyType
is set as string
.
Can you share you models schemas and the definition of the relationships?
This was not a problem in 1.1.16 but is a problem in 1.1.17onward I have reverted my package to only use 1.1.16 and it removes the problem.
Below is the query that a relationship runs which works in 1.1.16 but not in 1.1.17
SQLSTATE[HY000]: General error: 206 Operand type clash: uniqueidentifier is incompatible with tinyint [206] (severity 16) [select * from [ProdCode] where [ProdCode].[PCID] in (740, 4, 6, 7594778, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 1156000000000, 11, 142, 14, 14, 15, 176, 188, 1, 1, 1, 20, 22, 0, 25464, 9223372036854775807, 269, 278, 2953, 2, 2, 2, 3013055, 30240254, 30505240, 319, 31, 339, 343, 354, 378, 3, 3, 43, 4557, 46543, 47, 484, 4970, 4, 0, 4, 4, 4, 4, 52, 53, 5400000, 55, 5, 5, 5, 5, 9223372036854775807, 6013, 63, 660884, 67, 6, 6, 0, 9223372036854775807, 6, 70, 713337, 9223372036854775807, 76298180, 764310, 7, 7, 7, 7, 9223372036854775807, 7, 7, 7, 7, 805, 9223372036854775807, 0, 8833, 88, 8900000000000000000, 9223372036854775807, 9312, 94114673, 974, 991, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)] (SQL: select * from [ProdCode] where [ProdCode].[PCID] in (740, 4, 6, 7594778, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 1156000000000, 11, 142, 14, 14, 15, 176, 188, 1, 1, 1, 20, 22, 0, 25464, 9223372036854775807, 269, 278, 2953, 2, 2, 2, 3013055, 30240254, 30505240, 319, 31, 339, 343, 354, 378, 3, 3, 43, 4557, 46543, 47, 484, 4970, 4, 0, 4, 4, 4, 4, 52, 53, 5400000, 55, 5, 5, 5, 5, 9223372036854775807, 6013, 63, 660884, 67, 6, 6, 0, 9223372036854775807, 6, 70, 713337, 9223372036854775807, 76298180, 764310, 7, 7, 7, 7, 9223372036854775807, 7, 7, 7, 7, 805, 9223372036854775807, 0, 8833, 88, 8900000000000000000, 9223372036854775807, 9312, 94114673, 974, 991, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
This is a straight-up relationship as follows:
public function product_code()
{
return $this->belongsTo(ProductCode::class,'PCID','PCID');
}
And it must use your package because other models hook up to it with dual key and it doesn't always pick up. As I said it was working but now it's broken.
My Laravel is up to date as of 7.13.0
Verified it does not work with the 2.0.0 branch as well.
Changing the query to the below works:
public function product_code()
{
return $this->belongsTo(ProductCode::class,['PCID'],['PCID']);
}
Correction this does not work in 2.0.0 so assuming it's not working in the prior versions
@matalina Thanks for the input. I'll investigate
hello
can you please retest your case on master branch? I have added some test coverage for your case (https://github.com/topclaudy/compoships/pull/108) but it looks like it was already fixed in master.
regards