Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

postgresql insert string

# When I used Python to insert values into PostgreSQL, I also met the question: column "xxx" does not exist.
# The I find the reason in wiki.postgresql:
# PostgreSQL uses only single quotes for this (i.e. WHERE name = 'John'). Double quotes are used to quote system identifiers; field names, table names, etc. (i.e. WHERE "last name" = 'Smith').
# MySQL uses ` (accent mark or backtick) to quote system identifiers, which is decidedly non-standard.
# It means PostgreSQL can use only single quote for field names, table names, etc. So you can not use single quote in value.
# My situation is: I want to insert values "the difference of it’s adj for sb and it's adj of sb" into PostgreSQL.
# How I figure out this problem:
#I replace ' with ’, and I replace " with '. Because PostgreSQL value does not support double quote.
insert into test values (1,'user’s log');
insert into test values (2,'my users');
insert into test values (3,'customer’s');
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #postgresql #insert #string
ADD COMMENT
Topic
Name
2+3 =