Skip to content

feat(postgres): Added support for PostgreSQL OID type conversion (as u32) #830

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
Jul 22, 2025

Conversation

alexander-beedie
Copy link
Contributor

@alexander-beedie alexander-beedie commented Jul 22, 2025

Minor addition of support for the oid PostgreSQL identifier type, so it's a little easier to interact with system tables; oid is a u32 type, and can be directly read as such.

Ref: PostgreSQL OID type details.

Example

Loading some data from the pg_class system table:

import connectorx as cx

cx.read_sql(
    conn="postgresql://<user>:<pass>@<host>:<port>/<db>",
    query="""
        SELECT oid, relname 
        FROM pg_class
        WHERE relkind = 't'
    """,
    return_type="polars",
)

Before:

# PanicException: not implemented: oid

After:

# shape: (88, 2)
# ┌───────────┬────────────────────┐
# │ oid       ┆ relname            │
# │ ---       ┆ ---                │
# │ u32       ┆ str                │
# ╞═══════════╪════════════════════╡
# │ 75665     ┆ pg_toast_75661     │
# │ 75676     ┆ pg_toast_75672     │
# │ 337455076 ┆ pg_toast_337455072 │
# │ …         ┆ …                  │
# │ 3772379   ┆ pg_toast_3772376   │
# │ 3772397   ┆ pg_toast_3772393   │
# │ 4066652   ┆ pg_toast_4066648   │
# └───────────┴────────────────────┘

@wangxiaoying
Copy link
Contributor

Thanks @alexander-beedie !

@wangxiaoying wangxiaoying merged commit 0f0b835 into sfu-db:main Jul 22, 2025
2 checks passed
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.

2 participants