question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"tuple concurrently updated" with Postgres

See original GitHub issue

Describe the bug

Error while creating a view in postgres

  deadlock detected
  DETAIL:  Process 187 waits for ShareLock on transaction 19479; blocked by process 186.
  Process 186 waits for ShareLock on transaction 19480; blocked by process 187.
  HINT:  See server log for query details.
  CONTEXT:  while updating tuple (1,11) in relation "pg_class"

Occassionally also throws this: tuple concurrently updated

Steps To Reproduce

Have 2 sql files under the same model - they work when only one exists. But when two exist in the same folder (model), the error above throws.

The two sql files refer to different tables within the same schema.

Expected behavior

2 views should be created without errors

System information

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

installed version: 0.19.1
   latest version: 0.19.2

Your version of dbt is out of date! You can find instructions for upgrading here:
https://docs.getdbt.com/docs/installation

Plugins:
  - redshift: 0.19.1
  - bigquery: 0.19.1
  - snowflake: 0.19.1
  - postgres: 0.19.1

The operating system you’re using: Ubuntu 20.0.4

The output of python --version: Python 3.8.5

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jtcohen6commented, Jul 14, 2021

@sdabhi23 My sense is, those two grant statements need to be running concurrently to hit this error. I imagine the view models and grant statements each take <1s to execute. The error will raise only when the queries overlap, which may not be in every invocation.

1reaction
sdabhi23commented, Jul 13, 2021

@jtcohen6 I agree that issue is with concurrent grants. But do you have any idea why this behaviour is flaky?

I mean sometimes it fails sometimes it doesn’t. That’s the behaviour I have observed. It only failed when those 2 particular views were running concurrently.

I will definitely switch to model specific grants, but just a thought

Read more comments on GitHub >

github_iconTop Results From Across the Web

Postgres ERROR: tuple concurrently updated
Your plain subselect fetches up to 100 rows, but does not lock them against write access. Concurrent transactions can update or delete one ......
Read more >
Postgresql - ERROR : tuple concurrently updated
It means that you need to update provide thread safety by yourself using transaction so running the query inside transaction might fix your ......
Read more >
"tuple concurrently updated" with Postgres #3508 - GitHub
Have 2 sql files under the same model - they work when only one exists. But when two exist in the same folder...
Read more >
ERROR: tuple concurrently updated - PostgreSQL
Hello. Testing of the concurrent access to database objects leaded to the following error: ERROR: tuple concurrently updated.
Read more >
Thread: tuple concurrently updated - Postgres Professional
Hi, getting this error: DELETE FROM planet_osm_line WHERE osm_id = -166570; FEHLER: tuple concurrently updated postgresql 10.1 any idea what ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found