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

Postgresql adapter #10

Closed
wants to merge 11 commits into from
Closed

Postgresql adapter #10

wants to merge 11 commits into from

Conversation

mrahhal
Copy link
Owner

@mrahhal mrahhal commented Nov 25, 2017

Closes #2

{
internal static string DevConnectionString =
Environment.GetEnvironmentVariable("MR_ASPNETCORE_JOBS_POSTGRESQL_CS_DEV") ??
@"Server=127.0.0.1;Port=5432;Database=MR.AspNetCore.Jobs.Dev;User Id=postgres;Password=password;";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this overrides what you configure as your connection string in your applications service configuration, so probably should remove it.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm mistaken somehow, this is the connection string that will be used at design time while developing only (to run migrations). In your own app, this whole class should never be used. That's supposedly what IDesignTimeDbContextFactory does. Can you explain why you think this will override that in the app?

return $@"
DELETE
FROM ""{schema}"".""{table}""
WHERE ExpiresAt < @now

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

postgres didn't like this field syntax. seems to need everything fully qualified with schema. this worked for me:

return $@"
DELETE
FROM ""{schema}"".""{table}""
WHERE ""{schema}"".""{table}"".""ExpiresAt"" < @now
AND ctid IN (
    SELECT ctid
    FROM  ""{schema}"".""{table}""
    ORDER BY ""{schema}"".""{table}"".""ExpiresAt""
    LIMIT @count
)";

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I have little experience with postgres, and not enough time to test things out (which is why this PR is still pending).

Copy link
Owner Author

@mrahhal mrahhal Jan 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With little simplification, I'd guess this should also work:

return $@"
DELETE
FROM ""{schema}"".""{table}""
WHERE ""ExpiresAt"" < @now
AND ctid IN (
    SELECT ctid
    FROM  ""{schema}"".""{table}""
    ORDER BY ""ExpiresAt""
    LIMIT @count
)";

The problem is with the LIMIT not being accepted without using CTID, I think.

@mrahhal
Copy link
Owner Author

mrahhal commented Nov 28, 2021

Closing for now since this is stale. No time to work on this package for now.

@mrahhal mrahhal closed this Nov 28, 2021
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

Successfully merging this pull request may close these issues.

Postgres Adapter
2 participants