2006-06-08 03:46:32 +04:00
|
|
|
import psycopg2
|
|
|
|
|
|
|
|
con = psycopg2.connect("dbname=test")
|
|
|
|
|
|
|
|
cur = con.cursor()
|
|
|
|
cur.execute("SELECT %s::regtype::oid", ('bytea', ))
|
2017-12-04 05:47:19 +03:00
|
|
|
print(cur.fetchone()[0])
|
2006-06-08 03:46:32 +04:00
|
|
|
# 17
|
|
|
|
|
|
|
|
cur.execute("CREATE DOMAIN thing AS bytea")
|
|
|
|
cur.execute("SELECT %s::regtype::oid", ('thing', ))
|
2017-12-04 05:47:19 +03:00
|
|
|
print(cur.fetchone()[0])
|
2006-06-08 03:46:32 +04:00
|
|
|
#62148
|
|
|
|
|
|
|
|
cur.execute("CREATE TABLE thingrel (thingcol thing)")
|
|
|
|
cur.execute("SELECT * FROM thingrel")
|
2017-12-04 05:47:19 +03:00
|
|
|
print(cur.description)
|
2006-06-08 03:46:32 +04:00
|
|
|
#(('thingcol', 17, None, -1, None, None, None),)
|