Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk insert generate wrong SQL statement #640

Closed
dmngu9 opened this issue Aug 3, 2020 · 0 comments
Closed

Bulk insert generate wrong SQL statement #640

dmngu9 opened this issue Aug 3, 2020 · 0 comments

Comments

@dmngu9
Copy link

dmngu9 commented Aug 3, 2020

This is my insert query

INSERT INTO
			user_books(
				user_id,
				status,
				books,
				updated_ts
			)
		VALUES (:user_id, :status, :books, NOW())
		ON CONFLICT(user_id)
		DO UPDATE SET
			books = EXCLUDED.books,
			updated_ts = NOW()
		WHERE
			user_books.user_id = EXCLUDED.user_id

This is the error pq: syntax error at or near \"ON\"

Query generated:

INSERT INTO
			user_books(
				user_id,
				status,
				books,
				updated_ts
			)
		VALUES ($1, $2, $3, NOW(),($4, $5, $6, NOW(),($7, $8, $9, NOW())
		ON CONFLICT(user_id)
		DO UPDATE SET
			books = EXCLUDED.books,
			updated_ts = NOW()
		WHERE
			user_books.user_id = EXCLUDED.user_id

theres missing bracket between each value to insert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants