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

Placeholder does not add trailing "s" for named placeholders using 2.9 #1291

Closed
wsb252 opened this issue Jun 16, 2021 · 2 comments
Closed

Placeholder does not add trailing "s" for named placeholders using 2.9 #1291

wsb252 opened this issue Jun 16, 2021 · 2 comments

Comments

@wsb252
Copy link

wsb252 commented Jun 16, 2021

If I run statement.as_query(conn) with the new version, the named placeholder fields are missing a trailing 's' which is required. The prior version (2.8.6) correctly puts the trailing "%(name)s" format

sql.Placeholder(name=location)

2.9 yields:
VALUES (%(location))

2.8.6 yields:
VALUES (%(location)s)

The syntax for 2.9 causes the subsequent .execute( ) command to fail

@dvarrazzo
Copy link
Member

oops. Fixing and releasing immediately.

@dvarrazzo
Copy link
Member

Turns out that there was a regression test for it, but it was spelled:

self.assert_(sql.Placeholder('foo').as_string(self.conn), '%(foo)s')

which always passed. It should have been self.assertEqual...

dvarrazzo added a commit that referenced this issue Jun 16, 2021
Fix also Placeholder tests, including an error which made an assert
always true, which made us miss the regression in #1291.
mergify bot referenced this issue in andrewbolster/bolster Nov 15, 2021
Bumps [psycopg2-binary](https://github.com/psycopg/psycopg2) from 2.9.1 to 2.9.2.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/psycopg/psycopg2/blob/master/NEWS">psycopg2-binary's changelog</a>.</em></p>
<blockquote>
<h2>Current release</h2>
<p>What's new in psycopg 2.9.2
^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Raise <code>ValueError</code> for dates &gt;= Y10k (:ticket:<code>[#1307](https://github.com/psycopg/psycopg2/issues/1307)</code>).</li>
<li><code>~psycopg2.errorcodes</code> map and <code>~psycopg2.errors</code> classes updated to
PostgreSQL 14.</li>
<li>Add preliminary support for Python 3.11 (:tickets:<code>[#1376](psycopg/psycopg2#1376), [#1386](https://github.com/psycopg/psycopg2/issues/1386)</code>).</li>
<li>Wheel package compiled against OpenSSL 1.1.1l and PostgreSQL 14.1
(:ticket:<code>[#1388](https://github.com/psycopg/psycopg2/issues/1388)</code>).</li>
</ul>
<p>What's new in psycopg 2.9.1
^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<p>Fix regression with named <code>sql.Placeholder</code> (:ticket:<code>[#1291](https://github.com/psycopg/psycopg2/issues/1291)</code>).</p>
<h2>What's new in psycopg 2.9</h2>
<ul>
<li><code>with connection</code> starts a transaction on autocommit transactions too
(:ticket:<code>[#941](https://github.com/psycopg/psycopg2/issues/941)</code>).</li>
<li>Timezones with fractional minutes are supported on Python 3.7 and following
(:ticket:<code>[#1272](https://github.com/psycopg/psycopg2/issues/1272)</code>).</li>
<li>Escape table and column names in <code>~cursor.copy_from()</code> and
<code>~cursor.copy_to()</code>.</li>
<li>Connection exceptions with sqlstate <code>08XXX</code> reclassified as
<code>~psycopg2.OperationalError</code> (a subclass of the previously used
<code>~psycopg2.DatabaseError</code>) (:ticket:<code>[#1148](https://github.com/psycopg/psycopg2/issues/1148)</code>).</li>
<li>Include library dirs required from libpq to work around MacOS build problems
(:ticket:<code>[#1200](https://github.com/psycopg/psycopg2/issues/1200)</code>).</li>
</ul>
<p>Other changes:</p>
<ul>
<li>Dropped support for Python 2.7, 3.4, 3.5 (:tickets:<code>[#1198](psycopg/psycopg2#1198), [#1000](psycopg/psycopg2#1000), [#1197](https://github.com/psycopg/psycopg2/issues/1197)</code>).</li>
<li>Dropped support for mx.DateTime.</li>
<li>Use <code>datetime.timezone</code> objects by default in datetime objects instead of
<code>~psycopg2.tz.FixedOffsetTimezone</code>.</li>
<li>The <code>psycopg2.tz</code> module is deprecated and scheduled to be dropped in the
next major release.</li>
<li>Provide :pep:<code>599</code> wheels packages (manylinux2014 tag) for i686 and x86_64
platforms.</li>
<li>Provide :pep:<code>600</code> wheels packages (manylinux_2_24 tag) for aarch64 and
ppc64le platforms.</li>
<li>Wheel package compiled against OpenSSL 1.1.1k and PostgreSQL 13.3.</li>
<li>Build system for Linux/MacOS binary packages moved to GitHub Actions.</li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/psycopg/psycopg2/commits">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=psycopg2-binary&package-manager=pip&previous-version=2.9.1&new-version=2.9.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
mergify bot referenced this issue in andrewbolster/bolster Dec 29, 2021
Bumps [psycopg2-binary](https://github.com/psycopg/psycopg2) from 2.9.2 to 2.9.3.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/psycopg/psycopg2/blob/master/NEWS">psycopg2-binary's changelog</a>.</em></p>
<blockquote>
<h2>Current release</h2>
<p>What's new in psycopg 2.9.3
^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Alpine (musl) wheels now available (:ticket:<code>[#1148](https://github.com/psycopg/psycopg2/issues/1148)</code>).</li>
</ul>
<p>What's new in psycopg 2.9.2
^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Raise <code>ValueError</code> for dates &gt;= Y10k (:ticket:<code>[#1307](https://github.com/psycopg/psycopg2/issues/1307)</code>).</li>
<li><code>~psycopg2.errorcodes</code> map and <code>~psycopg2.errors</code> classes updated to
PostgreSQL 14.</li>
<li>Add preliminary support for Python 3.11 (:tickets:<code>[#1376](psycopg/psycopg2#1376), [#1386](https://github.com/psycopg/psycopg2/issues/1386)</code>).</li>
<li>Wheel package compiled against OpenSSL 1.1.1l and PostgreSQL 14.1
(:ticket:<code>[#1388](https://github.com/psycopg/psycopg2/issues/1388)</code>).</li>
</ul>
<p>What's new in psycopg 2.9.1
^^^^^^^^^^^^^^^^^^^^^^^^^^^</p>
<p>Fix regression with named <code>sql.Placeholder</code> (:ticket:<code>[#1291](https://github.com/psycopg/psycopg2/issues/1291)</code>).</p>
<h2>What's new in psycopg 2.9</h2>
<ul>
<li><code>with connection</code> starts a transaction on autocommit transactions too
(:ticket:<code>[#941](https://github.com/psycopg/psycopg2/issues/941)</code>).</li>
<li>Timezones with fractional minutes are supported on Python 3.7 and following
(:ticket:<code>[#1272](https://github.com/psycopg/psycopg2/issues/1272)</code>).</li>
<li>Escape table and column names in <code>~cursor.copy_from()</code> and
<code>~cursor.copy_to()</code>.</li>
<li>Connection exceptions with sqlstate <code>08XXX</code> reclassified as
<code>~psycopg2.OperationalError</code> (a subclass of the previously used
<code>~psycopg2.DatabaseError</code>) (:ticket:<code>[#1148](https://github.com/psycopg/psycopg2/issues/1148)</code>).</li>
<li>Include library dirs required from libpq to work around MacOS build problems
(:ticket:<code>[#1200](https://github.com/psycopg/psycopg2/issues/1200)</code>).</li>
</ul>
<p>Other changes:</p>
<ul>
<li>Dropped support for Python 2.7, 3.4, 3.5 (:tickets:<code>[#1198](psycopg/psycopg2#1198), [#1000](psycopg/psycopg2#1000), [#1197](https://github.com/psycopg/psycopg2/issues/1197)</code>).</li>
<li>Dropped support for mx.DateTime.</li>
<li>Use <code>datetime.timezone</code> objects by default in datetime objects instead of
<code>~psycopg2.tz.FixedOffsetTimezone</code>.</li>
<li>The <code>psycopg2.tz</code> module is deprecated and scheduled to be dropped in the
next major release.</li>
<li>Provide :pep:<code>599</code> wheels packages (manylinux2014 tag) for i686 and x86_64</li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/psycopg/psycopg2/commits">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=psycopg2-binary&package-manager=pip&previous-version=2.9.2&new-version=2.9.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
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