8000 fix: postgres query by ankush · Pull Request #19357 · frappe/frappe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: postgres query #19357

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

Merged
merged 1 commit into from
Dec 20, 2022
Merged

fix: postgres query #19357

merged 1 commit into from
Dec 20, 2022

Conversation

ankush
Copy link
Member
@ankush ankush commented Dec 20, 2022

Double quotes are supposed to be used for table/columns only in
postgres. Mariadb is fine with either.

Broken since #19347 but not because of it

======================================================================
 ERROR  test_ignore_links_on_delete (frappe.tests.test_hooks.TestHooks.test_ignore_links_on_delete)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/frappe-bench/apps/frappe/frappe/tests/test_hooks.py", line 80, in test_ignore_links_on_delete
    ).insert()
      ^^^^^^^^
    email_unsubscribe = <EmailUnsubscribe: a4e3488b25>
    self = <frappe.tests.test_hooks.TestHooks testMethod=test_ignore_links_on_delete>
  File "/home/runner/frappe-bench/apps/frappe/frappe/model/document.py", line 268, in insert
    self.run_before_save_methods()
    ignore_if_duplicate = False
    ignore_links = None
    ignore_mandatory = None
    ignore_permissions = None
    self = <Event: EV00053>
    set_child_names = True
    set_name = None
  File "/home/runner/frappe-bench/apps/frappe/frappe/model/document.py", line 1056, in run_before_save_methods
    self.run_method("before_save")
    self = <Event: EV00053>
  File "/home/runner/frappe-bench/apps/frappe/frappe/model/document.py", line 920, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    args = ()
    fn = <function Document.run_method.<locals>.fn at 0x7f680add1e40>
    args = ()
    kwargs = {'as_dict': True}
    query = 'select parent,\n\t\t\tIFNULL((select is_primary_contact from tabContact c where c.name = dl.parent), 0)\n\t\t\t\tas is_primary_contact\n\t\tfrom\n\t\t\t`tabDynamic Link` dl\n\t\twhere\n\t\t\tdl.link_doctype=%s and\n\t\t\tdl.link_name=%s and\n\t\t\tdl.parenttype = "Contact"'
    self = <frappe.database.postgres.database.PostgresDatabase object at 0x7f68128aca50>
    values = ('Email Unsubscribe', 'a4e3488b25')
  File "/home/runner/frappe-bench/apps/frappe/frappe/database/database.py", line 221, in sql
    self._cursor.execute(query, values)
    as_dict = True
    as_list = 0
    auto_commit = 0
    debug = False
    explain = False
    ignore_ddl = 0
    pluck = False
    query = 'select parent,\n\t\t\tcoalesce((select is_primary_contact from "tabContact" c where c.name = dl.parent), 0)\n\t\t\t\tas is_primary_contact\n\t\tfrom\n\t\t\t"tabDynamic Link" dl\n\t\twhere\n\t\t\tdl.link_doctype=%s and\n\t\t\tdl.link_name=%s and\n\t\t\tdl.parenttype = "Contact"'
    run = True
    self = <frappe.database.postgres.database.PostgresDatabase object at 0x7f68128aca50>
    update = None
    values = ['Email Unsubscribe', 'a4e3488b25']
psycopg2.errors.UndefinedColumn: column "Contact" does not exist
LINE 9:    dl.parenttype = "Contact"
                           ^

8000
Double quotes are supposed to be used for table/columns only in
postgres. Mariadb is fine with either.
@ankush ankush requested review from a team and phot0n and removed request for a team December 20, 2022 07:06
@ankush ankush added the postgres postgres db related issue/PRs label Dec 20, 2022
@github-actions github-actions bot added the add-test-cases Add test case to validate fix or enhancement label Dec 20, 2022
@ankush ankush added backport version-14-hotfix backport to version 14 and removed add-test-cases Add test case to validate fix or enhancement labels Dec 20, 2022
@ankush ankush merged commit 89a3415 into develop Dec 20, 2022
@ankush ankush deleted the pg branch December 20, 2022 07:20
mergify bot pushed a commit that referenced this pull request Dec 20, 2022
Double quotes are supposed to be used for table/columns only in
postgres. Mariadb is fine with either.

[skip ci]

(cherry picked from commit 89a3415)
ankush added a commit that referenced this pull request Dec 20, 2022
Double quotes are supposed to be used for table/columns only in
postgres. Mariadb is fine with either.

[skip ci]

(cherry picked from commit 89a3415)

Co-authored-by: Ankush Menat <ankush@frappe.io>
frappe-pr-bot pushed a commit that referenced this pull request Dec 20, 2022
# [14.20.0](v14.19.1...v14.20.0) (2022-12-20)

### Bug Fixes

* allow zero page length in `get_list` to return complete list ([#19322](#19322)) ([#19341](#19341)) ([715aaa6](715aaa6))
* better check of whether doctype is child table ([#19329](#19329)) ([#19343](#19343)) ([0c0d1ef](0c0d1ef))
* datepicker not working for arabic language (backport [#19358](#19358)) ([#19361](#19361)) ([8d791cc](8d791cc))
* db ssl connection ([#19308](#19308)) ([#19339](#19339)) ([3bf65be](3bf65be))
* dont share with self for standard users (backport [#19327](#19327)) ([#19338](#19338)) ([a3be135](a3be135))
* duplicate unique indexes (backport [#19291](#19291)) ([#19297](#19297)) ([bc92e1c](bc92e1c))
* handle `HTML` code field's `has_content` ([9bc679e](9bc679e))
* if grid custom button is not set grid has some extra space on top ([4f19f68](4f19f68))
* in web form if print format is empty getting error ([f8e227c](f8e227c))
* move filelock import to function ([ee9b1aa](ee9b1aa))
* postgres query ([#19357](#19357)) ([#19359](#19359)) ([12ecae2](12ecae2))
* **postgres:** psql with remote databases (backport [#19362](#19362)) ([#19366](#19366)) ([60c853d](60c853d))
* restore missing `helpful` and `not_helpful` fields to help article doctype. ([#19309](#19309)) ([#19316](#19316)) ([3950865](3950865)), closes [#diff-3e0e1befb66af4c2ab84c6fe0e996dc602d906817f0b00b6239120af9da9be46](https://github.com/frappe/frappe/issues/diff-3e0e1befb66af4c2ab84c6fe0e996dc602d906817f0b00b6239120af9da9be46)
* sort prepared report filters ([#19267](#19267)) ([b3e16b8](b3e16b8))
* **trim-database:** Dont act on non-frappe tables (backport [#19292](#19292)) ([#19298](#19298)) ([34b2b24](34b2b24))
* use stricter regex for `sanitize_searchfield` (backport [#19277](#19277)) ([#19303](#19303)) ([4e870b3](4e870b3))
* **workflow:** Remove docstatus field from get_workflow_state_count ([#19332](#19332)) ([#19344](#19344)) ([34e8ecb](34e8ecb))

### Features

* add parameters language and letter_head to `download_pdf` ([99631d2](99631d2))
* fields for attaching (html) meta tags in web form (backport [#19306](#19306)) ([#19307](#19307)) ([6b0e585](6b0e585))

### Performance Improvements

* reuse `_doc_before_save` in `doc.get_latest` (backport [#19326](#19326)) ([#19346](#19346)) ([ff3de82](ff3de82))
developmentforpeople pushed a commit to developmentforpeople/frappe that referenced this pull request Jan 3, 2023
Double quotes are supposed to be used for table/columns only in
postgres. Mariadb is fine with either.

[skip ci]

(cherry picked from commit 89a3415)

Co-authored-by: Ankush Menat <ankush@frappe.io>
developmentforpeople pushed a commit to developmentforpeople/frappe that referenced this pull request Jan 3, 2023
# [14.20.0](frappe/frappe@v14.19.1...v14.20.0) (2022-12-20)

### Bug Fixes

* allow zero page length in `get_list` to return complete list ([frappe#19322](frappe#19322)) ([frappe#19341](frappe#19341)) ([715aaa6](frappe@715aaa6))
* better check of whether doctype is child table ([frappe#19329](frappe#19329)) ([frappe#19343](frappe#19343)) ([0c0d1ef](frappe@0c0d1ef))
* datepicker not working for arabic language (backport [frappe#19358](frappe#19358)) ([frappe#19361](frappe#19361)) ([8d791cc](frappe@8d791cc))
* db ssl connection ([frappe#19308](frappe#19308)) ([frappe#19339](frappe#19339)) ([3bf65be](frappe@3bf65be))
* dont share with self for standard users (backport [frappe#19327](frappe#19327)) ([frappe#19338](frappe#19338)) ([a3be135](frappe@a3be135))
* duplicate unique indexes (backport [frappe#19291](frappe#19291)) ([frappe#19297](frappe#19297)) ([bc92e1c](frappe@bc92e1c))
* handle `HTML` code field's `has_content` ([9bc679e](frappe@9bc679e))
* if grid custom button is not set grid has some extra space on top ([4f19f68](frappe@4f19f68))
* in web form if print format is empty getting error ([f8e227c](frappe@f8e227c))
* move filelock import to function ([ee9b1aa](frappe@ee9b1aa))
* postgres query ([frappe#19357](frappe#19357)) ([frappe#19359](frappe#19359)) ([12ecae2](frappe@12ecae2))
* **postgres:** psql with remote databases (backport [frappe#19362](frappe#19362)) ([frappe#19366](frappe#19366)) ([60c853d](frappe@60c853d))
* restore missing `helpful` and `not_helpful` fields to help article doctype. ([frappe#19309](frappe#19309)) ([frappe#19316](frappe#19316)) ([3950865](frappe@3950865)), closes [#diff-3e0e1befb66af4c2ab84c6fe0e996dc602d906817f0b00b6239120af9da9be46](https://github.com/frappe/frappe/issues/diff-3e0e1befb66af4c2ab84c6fe0e996dc602d906817f0b00b6239120af9da9be46)
* sort prepared report filters ([frappe#19267](frappe#19267)) ([b3e16b8](frappe@b3e16b8))
* **trim-database:** Dont act on non-frappe tables (backport [frappe#19292](frappe#19292)) ([frappe#19298](frappe#19298)) ([34b2b24](frappe@34b2b24))
* use stricter regex for `sanitize_searchfield` (backport [frappe#19277](frappe#19277)) ([frappe#19303](frappe#19303)) ([4e870b3](frappe@4e870b3))
* **workflow:** Remove docstatus field from get_workflow_state_count ([frappe#19332](frappe#19332)) ([frappe#19344](frappe#19344)) ([34e8ecb](frappe@34e8ecb))

### Features

* add parameters language and letter_head to `download_pdf` ([99631d2](frappe@99631d2))
* fields for attaching (html) meta tags in web form (backport [frappe#19306](frappe#19306)) ([frappe#19307](frappe#19307)) ([6b0e585](frappe@6b0e585))

### Performance Improvements

* reuse `_doc_before_save` in `doc.get_latest` (backport [frappe#19326](frappe#19326)) ([frappe#19346](frappe#19346)) ([ff3de82](frappe@ff3de82))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-14-hotfix backport to version 14 postgres postgres db related issue/PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0