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

Laravel Framework Query : "INSERT OR ignore ..." Syntax Error #30

Open
AtibaLee opened this issue May 7, 2024 · 1 comment
Open

Laravel Framework Query : "INSERT OR ignore ..." Syntax Error #30

AtibaLee opened this issue May 7, 2024 · 1 comment

Comments

@AtibaLee
Copy link

AtibaLee commented May 7, 2024

When using the LoginRequest RateLimiter that caches a failed login attempt Laravel attempts to run a query that starts with "INSERT OR ignore.. " . This syntax is not supported by snowflake.

This codeflow is part of the Laravel Framework. and I am unaware of how to change the query to use an alternative syntax.

Any alternative to the INSERT IGNORE syntax would be to use an insert that uses a select statement that has a where exists clause.

Example Query:

insert or ignore into "cache" ("key", "value", "expiration") values (?, ?, ?)

This exception is being thrown at

App\ Http\ Requests\ Auth\ LoginRequest: 45 authenticate

` public function authenticate(): void
{

    $this->ensureIsNotRateLimited();

    if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
        RateLimiter::hit($this->throttleKey());

        throw ValidationException::withMessages([
            'email' => trans('auth.failed'),
        ]);
    }
    RateLimiter::clear($this->throttleKey());
}`

Laravel Version : 11.5.0
PHP Version: 8.2.15

@yoramdelangen
Copy link
Collaborator

I think this was not implemented yet.. and Snowflake does not have a direct way of doing this. The only thing close is INSERT OVERWRITE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants