Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid input syntax for type uuid #79

Open
aliasbody opened this issue May 1, 2020 · 6 comments
Open

Invalid input syntax for type uuid #79

aliasbody opened this issue May 1, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@aliasbody
Copy link

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.

@topclaudy
Copy link
Owner

Can you share you models schemas and the definition of the relationships?

@matalina
Copy link

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

@matalina
Copy link

Verified it does not work with the 2.0.0 branch as well.

@matalina
Copy link

matalina commented May 26, 2020

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

@topclaudy
Copy link
Owner

@matalina Thanks for the input. I'll investigate

@yurii-github
Copy link
Contributor

yurii-github commented Nov 29, 2020

hello

can you please retest your case on master branch? I have added some test coverage for your case (#108) but it looks like it was already fixed in master.

regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants