-
Notifications
You must be signed in to change notification settings - Fork 29
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
fix createJobTable failure when table name contains dot #53
Conversation
@kanagarajkm good catch. But I think the correct fix is to use Identifier everywhere and let postgresql-simple do the rest. Would you mind taking that approach with this PR? |
@saurabhnanda yes, i can do that. But i am unsure about how to use |
bfd1478
to
76a1fd0
Compare
@kanagarajkm Try doing the following
let t :: Identifier = "public.jobs"
formatQuery conn "select * from ? where id=?" (t, 1 :: Int) |
@saurabhnanda Thanks for the suggestion. I will update the PR accordingly. |
76a1fd0
to
e33266a
Compare
`createJobTable` fails when the table name contains a dot for example `myschema.jobs`.
e33266a
to
4bc3c82
Compare
@saurabhnanda i have updated the PR, please take a look. |
src/OddJobs/Types.hs
Outdated
@@ -33,10 +34,10 @@ import Control.Monad.Logger (LogLevel) | |||
-- myJobsTable :: TableName | |||
-- myJobsTable = "my_jobs" | |||
-- @ | |||
type TableName = PGS.Query | |||
type TableName = PGS.Identifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the comment on this type should be updated, as it refers to the old underlying Query
type. Perhaps it could be phrased in a way that says what it is for, rather than what its type is, so that it can't get out of sync with the code. Something like "A type alias used for table names. ..."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@saurabhnanda when |
@kanagarajkm this doesn't seem right at all. This seems like a bug in postgresql-simple. Would you like to open a bug in that repo and see where this goes? Or are we using |
@saurabhnanda switched to |
Thanks @kanagarajkm -- merged it just in time for Hacktoberfest. Sorry about the delay -- have had a crazy week at work. |
@saurabhnanda thanks a lot!. Awesome work on the library. |
@saurabhnanda is there a plan to make a new release with the latest fixes? I am using the github repo as the dependency on our project. Thanks. |
@kanagarajkm I was waiting to make a new release to bundle all breaking changes together (especially #55). Are you in a hurry to get a public release? |
* fix createJobTable failure when table name contains dot `createJobTable` fails when the table name contains a dot for example `myschema.jobs`. * update TableName comment * use QualifiedIdentifier * Modified docs for TableName Co-authored-by: Saurabh Nanda <[email protected]>
@saurabhnanda ok, its not urgent, i am using the git source for now. Thanks |
createJobTable
fails when the table name contains a dotfor example
myschema.jobs
.Fixes #52