Skip to content
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

cannot insert in PostgreSQL 8.1 #473

Closed
Marruixu opened this issue May 11, 2018 · 1 comment
Closed

cannot insert in PostgreSQL 8.1 #473

Marruixu opened this issue May 11, 2018 · 1 comment

Comments

@Marruixu
Copy link

Marruixu commented May 11, 2018

Hi,

Recap:
I'm using postgreSQL version 8.1.23 and I got this error:

psycopg2.ProgrammingError: syntax error at or near «RETURNING»
LINE 1: INSERT INTO tbl (val) VALUES (E'abc') RETURNING tbl.id

This is the code that runs the insert from the demo code in README:

    metadata = sa.MetaData()

    tbl = sa.Table('tbl', metadata,
        sa.Column('id', sa.Integer, primary_key=True),
        sa.Column('val', sa.String(255)))

    await conn.execute(tbl.insert().values(val='abc'))

    async for row in conn.execute(tbl.select()):
        print(row.id, row.val)

I've created the engine with enable_hstore set to False in order to work with this Postgres version. I am already acquiring connections from this engine and querying selects and they're all working fine.

I've also created tables with implicit_returning=False, which I found in source code to prevent adding RETURNING clause, cause I've seen that is not a valid clause in this PostgreSQL version.

But now, I've seen that if no default is defined in column or is None, appears after awaiting query:
AttributeError: 'NoneType' object has no attribute 'is_callable'

I don't see clearly how can I set specific dialect or to insert items... :(

Thank you in advance!

@Marruixu Marruixu changed the title syntax error at or near «RETURNING» using PostgreSQL 8.1 Default value for autoincrementing column when inserting in PostgreSQL 8.1 May 11, 2018
@Marruixu Marruixu changed the title Default value for autoincrementing column when inserting in PostgreSQL 8.1 cannot insert in PostgreSQL 8.1 May 11, 2018
@asvetlov
Copy link
Member

aiopg.sa doesn't check postgres server version and doesn't adopt a dialect to it.
PostgreSQL 8.1 is 13 years old and not supported anymore by Postgres team.
The library does not support it as well.

P.S. RETURNING appeared in Postgres 9

@Pliner Pliner closed this as completed Dec 21, 2020
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

No branches or pull requests

3 participants