代码之家  ›  专栏  ›  技术社区  ›  Onur

Postgresql返回零长度分隔错误

  •  0
  • Onur  · 技术社区  · 6 年前

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

    我正在使用Laravel的默认数据库表来存储用户数据。在使用MySQL的时候,每件事都能很好地工作,但是我不明白使用PgSQL的原因。任何帮助都将不胜感激。

    0 回复  |  直到 6 年前
        1
  •  1
  •   Sakthivel A R    6 年前

    错误:

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

    对的:

    使用数据库名称

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

    (或)

    select * from "users" where "email" = $email limit 1
    
    User::where('email',$email)->first();
    

    Check.env和database.php设置使用正确的数据库更新