Saving query produces an error
uri opened this issue · 0 comments
uri commented
OS: macOS 10.14.4
PostgreSQL: 9.6.8
If I press Run Query the query executes correctly and shows the expected results. But if I Save Query it produces an error.
Query
with users_by_month as (
select
id,
email,
date_part('year', created_at)::integer as "year",
date_part('month', created_at)::integer as "month"
from users
)
select
to_char( make_date(year,month, 1), 'YYYY MONTH' ) as "Month",
count(*) as "User Signups"
from users_by_month
group by year, month
order by year, month
;
Error after saving
Database error 42601: syntax error at or near "year" QUERY: with users_by_month as ( select id, email, date_part('year', created_at)::integer as "year", date_part('month', created_at)::integer as "month" from users)select to_char( make_date(year,month, 1), 'YYYY MONTH' ) as "Month", count(*) as "User Signups"from users_by_monthgroup by year, monthorder by year, month;
Date/time: 2018-04-26-15:03An unhandled error condition has been signalled:
Database error 42601: syntax error at or near "year"
QUERY: with users_by_month as ( select id, email, date_part('year', created_at)::integer as "year", date_part('month', created_at)::integer as "month" from users)select to_char( make_date(year,month, 1), 'YYYY MONTH' ) as "Month", count(*) as "User Signups"from users_by_monthgroup by year, monthorder by year, month;
Backtrace for: #
0: (TRIVIAL-BACKTRACE:PRINT-BACKTRACE-TO-STREAM #)
1: (TRIVIAL-BACKTRACE:PRINT-BACKTRACE # :OUTPUT NIL :IF-EXISTS :APPEND :VERBOSE T)
2: (PGCHARTS::FRONT-RAW-QUERY "7Q2")
3: ((:METHOD HUNCHENTOOT:ACCEPTOR-DISPATCH-REQUEST (SIMPLE-ROUTES:SIMPLEROUTES-ACCEPTOR T)) # #) [fast-method]
4: ((:METHOD HUNCHENTOOT:HANDLE-REQUEST (HUNCHENTOOT:ACCEPTOR HUNCHENTOOT:REQUEST)) # #) [fast-method]
5: ((:METHOD HUNCHENTOOT:PROCESS-REQUEST (T)) #) [fast-method]
6: (HUNCHENTOOT::DO-WITH-ACCEPTOR-REQUEST-COUNT-INCREMENTED # #)
7: ((:METHOD HUNCHENTOOT:PROCESS-CONNECTION (HUNCHENTOOT:ACCEPTOR T)) # #) [fast-method]
8: ((:METHOD HUNCHENTOOT:PROCESS-CONNECTION :AROUND (HUNCHENTOOT:ACCEPTOR T)) # #) [fast-method]
9: ((FLET HUNCHENTOOT::PROCESS-CONNECTION% :IN HUNCHENTOOT::HANDLE-INCOMING-CONNECTION%) # #)
10: ((LAMBDA NIL :IN BORDEAUX-THREADS::BINDING-DEFAULT-SPECIALS))
11: ((FLET SB-UNIX::BODY :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
12: ((FLET "WITHOUT-INTERRUPTS-BODY-4" :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
13: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
14: ((FLET "WITHOUT-INTERRUPTS-BODY-1" :IN SB-THREAD::CALL-WITH-MUTEX))
15: (SB-THREAD::CALL-WITH-MUTEX # #> NIL T NIL)
16: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE # NIL # NIL)
17: ("foreign function: call_into_lisp")
18: ("foreign function: new_thread_trampoline")
19: ("foreign function: _pthread_body")
20: ("foreign function: _pthread_body")
21: ("foreign function: thread_start")