Reputation: 141140
This question is based on this answer.
Upvotes: 3
Views: 728
Reputation: 7635
String literals in Postgres are defined using single quotes. Double quotes are used around identifiers. So the following query is valid.
SELECT "id", "name" FROM my_table WHERE "name" = 'Brian'
However, judging by the answer that you linked to, you're asking about single quote ' vs double quote " in PHP strings, rather than postgres queries.
The same as normal strings, a string in double quotes will interpolate variables, while a string in single quotes will have exactly what you put in.
$my_var = "noob";
echo "This is a test string, $my_var\nGot it?";
>> This is a test string, noob
>> Got it?
echo 'This is a test string, $my_var\nGot it?';
>> This is a test string, $my_var\nGot it?
Upvotes: 4
Reputation: 17314
Into a PostgreSQL query, you must use '
When you build a query in PHP, you may use ' or "
"select * from table where id = 'me'"
or
'select * from table where id = \'me\''
Upvotes: 3