mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-25 18:33:44 +03:00
9de46e416e
Forward compatible with newer Pythons.
19 lines
451 B
Python
19 lines
451 B
Python
import psycopg2
|
|
|
|
con = psycopg2.connect("dbname=test")
|
|
|
|
cur = con.cursor()
|
|
cur.execute("SELECT %s::regtype::oid", ('bytea', ))
|
|
print(cur.fetchone()[0])
|
|
# 17
|
|
|
|
cur.execute("CREATE DOMAIN thing AS bytea")
|
|
cur.execute("SELECT %s::regtype::oid", ('thing', ))
|
|
print(cur.fetchone()[0])
|
|
#62148
|
|
|
|
cur.execute("CREATE TABLE thingrel (thingcol thing)")
|
|
cur.execute("SELECT * FROM thingrel")
|
|
print(cur.description)
|
|
#(('thingcol', 17, None, -1, None, None, None),)
|