<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/postgresql-adapter-for-python-shad0j4za" -->

---
title: PostgreSQL adapter for Python | daily.dev
description: Psycopg 2.5.4, the widely used PostgreSQL adapter for Python, has shipped with out-of-the-box support for the new jsonb type introduced in PostgreSQL 9.4. The...
canonical: https://daily.dev/posts/postgresql-adapter-for-python-shad0j4za
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: PostgreSQL adapter for Python | daily.dev
og:description: Psycopg 2.5.4, the widely used PostgreSQL adapter for Python, has shipped with out-of-the-box support for the new jsonb type introduced in PostgreSQL 9.4. The...
og:url: https://daily.dev/posts/postgresql-adapter-for-python-shad0j4za
og:image: https://api.daily.dev/og/posts/ShaD0j4za.png
og:image:alt: PostgreSQL adapter for Python
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# PostgreSQL adapter for Python

**[Psycopg](https://daily.dev/sources/psycopg)** · 1 min read · 0 upvotes · 0 comments

## Summary

Psycopg 2.5.4, the widely used PostgreSQL adapter for Python, has shipped with out-of-the-box support for the new jsonb type introduced in PostgreSQL 9.4. The release also fixes a segfault when COPY statements are passed to execute(), forces pool argument conversion to integer to prevent unbounded pools, corrects WITH HOLD cursor transaction behavior, fixes a memory leak with large objects, and allows the internal _psycopg.so module to be imported standalone.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.psycopg.org/articles/2014/08/30/psycopg-254-released>

## Questions this post answers

### Does psycopg2 support the PostgreSQL jsonb type?

Yes, psycopg2 version 2.5.4 added out-of-the-box support for the jsonb type introduced in PostgreSQL 9.4. Prior to this release, jsonb required manual handling since the adapter did not natively recognize the type. This fix was tracked as ticket #226 in the psycopg2 issue tracker.

_Track database driver upgrades like this psycopg2 jsonb support on daily.dev._

### Why does my psycopg2 program segfault when I pass a COPY statement to execute()?

Passing a COPY statement directly to execute() instead of using the dedicated copy methods (like copy_from or copy_expert) caused a segfault in psycopg2 versions before 2.5.4. This was fixed in ticket #219, so upgrading to 2.5.4 or later resolves the crash. Use the proper COPY methods rather than execute() for COPY operations.

_Developers debugging psycopg2 crashes can find fixes like this one on daily.dev._

### Do WITH HOLD cursors in psycopg2 start a new transaction on move, fetch, or close?

No, as of psycopg2 2.5.4, WITH HOLD cursors no longer begin a new transaction when move, fetch, or close operations are performed on them, fixed under ticket #228. Additionally, this release allows WITH HOLD cursors to be used while in autocommit mode, addressed in ticket #229.

_daily.dev helps developers stay on top of driver-level fixes like psycopg2 cursor behavior._

## Similar posts on daily.dev

- [PostgreSQL: Psycopg 3.3 released](https://daily.dev/posts/postgresql-psycopg-3-3-released-ewfhnirnz) · PostgreSQL · 1 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/postgresql-adapter-for-python-shad0j4za)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"PostgreSQL adapter for Python","url":"https://daily.dev/posts/postgresql-adapter-for-python-shad0j4za","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/postgresql-adapter-for-python-shad0j4za"},"datePublished":"2026-08-23T12:18:55.930Z","dateModified":"2026-08-23T12:30:07.233Z","description":"Psycopg 2.5.4, the widely used PostgreSQL adapter for Python, has shipped with out-of-the-box support for the new jsonb type introduced in PostgreSQL 9.4. The...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b0cbd2ac8948f96ab39fa6a90db7464f?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b0cbd2ac8948f96ab39fa6a90db7464f?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Psycopg","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Psycopg","logo":"https://media.daily.dev/image/upload/s--5N-KNNWk--/f_auto,q_auto/v1787487485/logos/psycopg?_a=BAMAMicg0","url":"https://daily.dev/sources/psycopg"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/postgresql-adapter-for-python-shad0j4za","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,postgresql","timeRequired":"PT1M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Psycopg","item":"https://daily.dev/sources/psycopg"},{"@type":"ListItem","position":3,"name":"PostgreSQL adapter for Python"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/postgresql-adapter-for-python-shad0j4za#faq","mainEntity":[{"@type":"Question","name":"Does psycopg2 support the PostgreSQL jsonb type?","acceptedAnswer":{"@type":"Answer","text":"Yes, psycopg2 version 2.5.4 added out-of-the-box support for the jsonb type introduced in PostgreSQL 9.4. Prior to this release, jsonb required manual handling since the adapter did not natively recognize the type. This fix was tracked as ticket #226 in the psycopg2 issue tracker. Track database driver upgrades like this psycopg2 jsonb support on daily.dev."}},{"@type":"Question","name":"Why does my psycopg2 program segfault when I pass a COPY statement to execute()?","acceptedAnswer":{"@type":"Answer","text":"Passing a COPY statement directly to execute() instead of using the dedicated copy methods (like copy_from or copy_expert) caused a segfault in psycopg2 versions before 2.5.4. This was fixed in ticket #219, so upgrading to 2.5.4 or later resolves the crash. Use the proper COPY methods rather than execute() for COPY operations. Developers debugging psycopg2 crashes can find fixes like this one on daily.dev."}},{"@type":"Question","name":"Do WITH HOLD cursors in psycopg2 start a new transaction on move, fetch, or close?","acceptedAnswer":{"@type":"Answer","text":"No, as of psycopg2 2.5.4, WITH HOLD cursors no longer begin a new transaction when move, fetch, or close operations are performed on them, fixed under ticket #228. Additionally, this release allows WITH HOLD cursors to be used while in autocommit mode, addressed in ticket #229. daily.dev helps developers stay on top of driver-level fixes like psycopg2 cursor behavior."}}]}
```

