Troubleshooting of PostgreSQL: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
Troubleshooting of PostgreSQL
Troubleshooting of [https://www.postgresql.org/ PostgreSQL]


== How to fix Syntax error: 7 ERROR:  LIMIT #,# syntax is not supported ==
== Troubleshooting of PostgreSQL ==
=== How to fix Syntax error: 7 ERROR:  LIMIT #,# syntax is not supported ===
Query syntax mer error
Query syntax mer error
<pre>
<pre>
Line 15: Line 16:
</pre>
</pre>


Correct query syntax
Correct query syntax<ref>[http://www.sqlines.com/postgresql/limit_offset PostgreSQL Queries - OFFSET and LIMIT - Guide, Examples and Alternatives - SQLines Tools]</ref>
<pre>
<pre>
SELECT *  
SELECT *  
Line 22: Line 23:
</pre>
</pre>


== How to fix ERROR:  operator does not exist: ` character varying ==
=== How to fix ERROR:  operator does not exist: ` character varying ===
The following SQL query has a syntax error:
The following SQL query has a syntax error:
<pre>
<pre>
Line 45: Line 46:
</pre>
</pre>


== How to fix ERROR: argument of WHERE must be type boolean, not type integer ==
=== How to fix ERROR: argument of WHERE must be type boolean, not type integer ===
Query syntax mer error
Query syntax mer error
<pre>
<pre>
Line 67: Line 68:
</pre>
</pre>


== How to fix the ERROR: column "count" does not exist ==
=== How to fix the ERROR: column "count" does not exist ===
The following SQL query has a syntax error:
The following SQL query has a syntax error:
<pre>
<pre>
Line 83: Line 84:
having count(*) >= 2
having count(*) >= 2
</pre>
</pre>
=== How to fix: The numeric column data all became null after imported ===
[[Troubleshooting of Navicat for PostgreSQL]]
=== pgAdmin 4 on macOS Has No Autocomplete for Field or Table Names ===
[https://www.pgadmin.org/download/ pgAdmin] 4 has autocomplete built in by default, but it sometimes needs to be triggered manually or configured first.
'''How to trigger it'''
In the Query Tool, press `Ctrl / Cmd + Space`. However, on macOS, `Ctrl + Space` is reserved for switching input methods, and `Cmd + Space` opens Spotlight, so the shortcut conflict likely prevents the autocomplete menu from appearing. This menu is what normally shows suggestions for tables, columns, schemas, and keywords.
'''How to make autocomplete appear as you type'''
# Windows / Linux: Go to File → Preferences → Query Tool → Auto Completion, and make sure "Keywords autocomplete?" is checked.
# Mac: Go to pgAdmin 4 → Preferences → Query Tool → Auto Completion, and make sure "Keywords autocomplete?" is checked.


== Further reading ==
== Further reading ==
Line 91: Line 108:
<references />
<references />


== The numeric column data all became null after imported ==
 
[[Troubleshooting of Navicat for PostgreSQL]]


{{Template:Troubleshooting}}
{{Template:Troubleshooting}}

Latest revision as of 15:17, 16 June 2026

Troubleshooting of PostgreSQL

Troubleshooting of PostgreSQL[edit]

How to fix Syntax error: 7 ERROR: LIMIT #,# syntax is not supported[edit]

Query syntax mer error

SELECT * 
FROM my_table
LIMIT 0,10

Error message

Uncaught PDOException: SQLSTATE[42601]: Syntax error: 7 ERROR:  LIMIT #,# syntax is not supported                                                         
HINT:  Use separate LIMIT and OFFSET clauses.

Correct query syntax[1]

SELECT * 
FROM my_table
LIMIT 10 OFFSET 0

How to fix ERROR: operator does not exist: ` character varying[edit]

The following SQL query has a syntax error:

SELECT `my_columm`
from my_table
LIMIT 10

Error message

ERROR:  operator does not exist: ` character varying
LINE 1: SELECT `content_hash`
               ^
HINT:  No operator matches the given name and argument type. You might need to add an explicit type cast.

To fix the error, update the query with the correct syntax:

SELECT my_columm
from my_table
LIMIT 10

How to fix ERROR: argument of WHERE must be type boolean, not type integer[edit]

Query syntax mer error

SELECT * 
FROM my_table
WHERE 1

Correct query syntax

SELECT * 
FROM my_table
WHERE 1 = 1

or

SELECT * 
FROM my_table
WHERE TRUE

How to fix the ERROR: column "count" does not exist[edit]

The following SQL query has a syntax error:

SELECT count(*) count, content_hash
from my_table
GROUP BY content_hash
having count >= 2

To fix the error, update the query with the correct syntax:

SELECT count(*) count, content_hash
from my_table
GROUP BY content_hash
having count(*) >= 2

How to fix: The numeric column data all became null after imported[edit]

Troubleshooting of Navicat for PostgreSQL


pgAdmin 4 on macOS Has No Autocomplete for Field or Table Names[edit]

pgAdmin 4 has autocomplete built in by default, but it sometimes needs to be triggered manually or configured first.

How to trigger it In the Query Tool, press `Ctrl / Cmd + Space`. However, on macOS, `Ctrl + Space` is reserved for switching input methods, and `Cmd + Space` opens Spotlight, so the shortcut conflict likely prevents the autocomplete menu from appearing. This menu is what normally shows suggestions for tables, columns, schemas, and keywords.

How to make autocomplete appear as you type

  1. Windows / Linux: Go to File → Preferences → Query Tool → Auto Completion, and make sure "Keywords autocomplete?" is checked.
  2. Mac: Go to pgAdmin 4 → Preferences → Query Tool → Auto Completion, and make sure "Keywords autocomplete?" is checked.

Further reading[edit]

References[edit]



Troubleshooting of ...

Template