删除“列不存在" [英] delete "column does not exist"

查看:109
本文介绍了删除“列不存在"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Postgres中执行一个非常简单的删除查询

I'm trying to execute a very simple delete query in Postgres

查询:

delete from "Tasks" where id = "fc1f56b5-ff41-43ed-b27c-39eac9354323";

结果:

ERROR:  column "fc1f56b5-ff41-43ed-b27c-39eac9354323" does not exist
LINE 1: delete from "Tasks" where id = "fc1f56b5-ff41-43ed-...

我有一个简单的表,其中有一个ID为该值的记录.为什么"fc1f56b5-ff41-43ed-b27c-39eac9354323"是列名呢?

I have a simple table with a record where the id is that value. Why does it thing that "fc1f56b5-ff41-43ed-b27c-39eac9354323" is the column name?

推荐答案

问题是您正在交替使用双引号(")和单引号('). SQL将双引号"中的内容视为标识符(即表名,过程名,列名等),字符常量必须为

The problem is that you are using double quotes (") and single quotes (') interchangeably. SQL treats what's inside double quotes "" as an identifier (i.e., table name, proc name, column name, etc.), character constants need to be enclosed in single quotes

您可以说:

delete from "Tasks" where id = 'fc1f56b5-ff41-43ed-b27c-39eac9354323'

这篇关于删除“列不存在"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆