We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No 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? No Sign in to your account
Accordingly to the documentation when an inet value is missing the subnet it is assumed to be a single host.
inet
When I insert such value thru asyncpg however something goes wrong, as the following script shows:
import asyncio import asyncpg SETUP_SQL = """\ CREATE TABLE test_inet ( id serial not null primary key, address inet ) """ INSERT_SQL_1 = """ INSERT INTO test_inet (address) VALUES ('192.168.1.100') """ INSERT_SQL_2 = """ INSERT INTO test_inet (address) VALUES ($1) """ FETCH_SQL = """ SELECT address FROM test_inet ORDER BY id """ CLEANUP_SQL = """ DROP TABLE test_inet """ async def run(): conn = await asyncpg.connect(user='theuser', password='thepassword', database='test', host='127.0.0.1') await conn.execute(SETUP_SQL) try: await conn.execute(INSERT_SQL_1) await conn.execute(INSERT_SQL_2, '192.168.1.100') result = await conn.fetch(FETCH_SQL) print(result) finally: await conn.execute(CLEANUP_SQL) await conn.close() def main(): loop = asyncio.get_event_loop() loop.run_until_complete(run()) if __name__ == '__main__': main()
It emits:
[<Record address=IPv4Network('192.168.1.100/32')>, <Record address=IPv4Address('192.168.1.100')>]
Why does the second record, the one inserted using a parameter, have a different subnet? Am I doing something wrong?
The text was updated successfully, but these errors were encountered:
Oh, sorry, I saw #37 just now...
Sorry, something went wrong.
Another thing I'll wait 0.13 for! 😄
0.13 has been released with a fix for this.
No branches or pull requests
Accordingly to the documentation when an
inet
value is missing the subnet it is assumed to be a single host.When I insert such value thru asyncpg however something goes wrong, as the following script shows:
It emits:
Why does the second record, the one inserted using a parameter, have a different subnet?
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: