Skip to content

Tag: postgresql

Why isn’t SQLAlchemy creating serial columns?

SQLAlchemy is generating, but not enabling, sequences for columns in postgresql. I suspect I may be doing something wrong in engine setup. Using an example from the SQLAlchemy tutorial (http://docs.sqlalchemy.org/en/rel_0_9/orm/tutorial.html): With this script, the following table is generated: However, a seq…

How to do a batch commit in plpgsql?

When I do the below function, some errors occurs: Here is my sample code. So could anyone give me a sample of how to finish my job as the above code? I’m using PostgreSQL 9.2. Answer In general, I think there are three approaches you can take: Do without. Just let the whole thing be committed at once, l…

Postgres syntax error at or near “IF”

I am new to postgres and I am working on an assignment of mine. I had to create a table with only 1 column and, then I was given this statement to run in on pgadmin III: when I run this I get this error: syntax error at or near “IF” I have already take a look at this 38.6.2.