typelevel / typelevel/skunk

Skunk with CockroachDB and UNLISTEN command

Open
#593 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.7k
Forks
175
Avg merge
5d 14h
Merged PRs (30d)
9

Description

I have been working with integrating Skunk with CockroachDB. I have discussed about this integration in a blog post here.

Everything is working fine with CockroachDB integration, But I have got one issue with UNLISTEN on Postgres. Seems CockroachDB does not supports these commands yet. Due to this reason when running queries it gives following error at the end(the queries are successful, but end it raised the error for UNLISTEN * command).

Exception in thread "main" skunk.exception.PostgresErrorException: 
🔥  
🔥  Postgres ERROR 42601 raised in Error (lexer.go:246)
🔥  
🔥    Problem: At or near "unlisten": syntax error.
🔥     Detail: source SQL:
🔥  UNLISTEN *
🔥  ^
🔥  
🔥  The statement under consideration was defined
🔥    at «skunk internal»:0
🔥  
🔥    UNLISTEN *
🔥  
🔥  If this is an error you wish to trap and handle in your application, you can do
🔥  so with a SqlState extractor. For example:
🔥  
🔥    doSomething.recoverWith { case SqlState.SyntaxError(ex) =>  ...}
🔥  

skunk.exception.PostgresErrorException: At or near "unlisten": syntax error.
	at skunk.net.protocol.Query$$anon$1$$anonfun$apply$2.$anonfun$applyOrElse$12(Query.scala:179)
	at map @ skunk.net.protocol.Query$$anon$1$$anonfun$apply$2.$anonfun$applyOrElse$12(Query.scala:179)
	at modify @ skunk.util.Pool$.$anonfun$of$2(Pool.scala:91)
	at flatten$extension @ skunk.util.Pool$.$anonfun$of$2(Pool.scala:95)
	at flatMap @ skunk.net.MessageSocket$$anon$1.pump$1(MessageSocket.scala:80)
	at modify @ skunk.util.Pool$.$anonfun$of$2(Pool.scala:91)
	at flatten$extension @ skunk.util.Pool$.$anonfun$of$2(Pool.scala:95)
	at flatMap @ skunk.net.MessageSocket$$anon$1.pump$1(MessageSocket.scala:80)
	at modify @ skunk.util.Pool$.$anonfun$of$2(Pool.scala:91)
	at flatten$extension @ skunk.util.Pool$.$anonfun$of$2(Pool.scala:95)
	at flatMap @ skunk.net.MessageSocket$$anon$1.pump$1(MessageSocket.scala:80)
	at modify @ skunk.util.Pool$.$anonfun$of$2(Pool.scala:91)
	at flatten$extension @ skunk.util.Pool$.$anonfun$of$2(Pool.scala:95)

Process finished with exit code 1

Do you have any suggestion or workaround for this? As the error suggested, manually handling it with .recoverWith would be a workaround?

Thank you very much.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the UNLISTEN * statement shown at skunk.net.protocol.Query, Query.scala:179, and reproduce the failure against CockroachDB. Done should prevent the unsupported command from raising an error while preserving PostgreSQL behavior; the issue does not name a test or specify the requested implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgres, scala
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.