Webpy Currval is still not defined at insert

Source: Internet
Author: User

Occurs when inserting data to Postgres using Webpy's Db.insert ()

traceback  (most recent call last):  file  "upgrade2.0.py", line  170, in <module>    copy_webservice ()   File  "upgrade2.0.py" ,  line 165, in copy_webservice    db36.insert (' Top_node_location ',  **r)   File  "/usr/lib/python2.7/site-packages/web/db.py",  line 777, in  insert    self._db_execute (db_cursor, sql_query)   File  "/usr/lib /python2.7/site-packages/web/db.py ",  line 587, in _db_execute    out  = cur.execute (query, params)   File  "/usr/lib/python2.7/site-packages/dbutils/ steadydb.py ",  line 631, in tough_method    raise error #  reraise the original error againpsycopg2. operationalerror:  error:   in this session sequence   "top_node_location_id_seq "   currval  is still not defined 

Find/lib/python2.7/site-packages/web/db.py

Def _process_insert_query (self, query, tablename, seqname):     if  seqname is None:        # when seqname  Is not provided guess the seqname and make sure it exists         seqname = tablename +  "_id_seq"          if seqname not in self._get_all_sequences ():             seqname = None         if seqname:        #  Comment out this sentence          #query  +=  ";  select currval ('%s ')"  % seqname        pass             rEturn query 

The reason is that when webpy inserts, there is an extra select that uses Currval to get the current sequence value, but Currval () is not supported in postgres9.3.

It seems that the Webpy author died, and there was no update maintenance


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.