简体   繁体   中英

Postgresql return zero-length delimited error

I am trying to make a connection with PostgreSQL 12 for Laravel framework. I use Laravel 5.8 version. When I try to login a user by using Laravel's Auth::attempt() method, I get the following error:

Syntax error: 7 ERROR: zero-length delimited identifier at or near \\"\\"\\"\\"\\nLINE 1: select * from \\"\\".\\"users\\" where \\"email\\" = $1 limit 1\\

I am using Laravel's default database table for user data. Eveyrthing works well when using MySQL but I did not understand the reason of it when I use PgSQL. Any help would be much appreciated.

Double quotes make delimited identifiers. It should not be empty string like below.

Wrong:

select * from ""."users" where "email" = $email limit 1

Correct:

Use database name

select * from "$databaseName"."users" where "email" = $email limit 1

(or) Try without database name

select * from "users" where "email" = $email limit 1

User::where('email',$email)->first();

Check .env and database.php settings are updated with correct database name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM