Does table1 have a column called "table1_id"? Seems strange. Who
created the csv file?

On Aug 19, 2:06 pm, Richard Vézina <ml.richard.vez...@gmail.com>
wrote:
> I got it... Wrong model definition caused by a search an replace... Sorry!
>
> But there is still a problem with the importation as detailed in the PS.:
> section of my intial emai.
>
> Here a copy :
>
> PS.: There is a problem on importation of exported csv file from the admin
> interface... The id field of exported csv is : table1.table1_id that
> correct, but the importation fail if I am not changing the *table1.table1_id
> * header for *table1.id*
>
> 2010/8/19 Richard Vézina <ml.richard.vez...@gmail.com>
>
> > Ok, the problem is not coming from the postgresql manipulation as I thought
> > it
> > was...
>
> > I did the manipulation on an other table and got no problem. The problem
> > seems to be
> > presente since some time, but I didn't detected it..
>
> > Richard
>
> > 2010/8/19 Richard Vézina <ml.richard.vez...@gmail.com>
>
> > Hello,
>
> >> I am stuck on a problem about which I don't have a clue how to solve...
>
> >> I explain what I did :
>
> >> I would reload my entire database tables with fresh manually generated
> >> data, so I flush out all the data that were in the database. I would have
> >> the Postgresql sequence to be reseted so I ALTER SEQUENCE
> >> table1_table1_id_seq RESTART WITH 1;
>
> >> I import my newly generated data from csv file with the admin interface.
> >> No problem until there...
>
> >> I can add new data to the table with my app form...
>
> >> But when I link table1_id from other table FK I get this error ticket :
>
> >> Traceback (most recent call last):
>
> >>   File "/version_183-2/web2py/gluon/restricted.py", line 186, in restricted
>
> >>     exec ccode in environment
>
> >>   File "/version_183-2/web2py/applications/app/controllers/default.py" 
> >> <http://admin/default/edit/devGUImdg1/controllers/lotns.py>, line 261, in 
> >> <module>
>
> >>   File "/version_183-2/web2py/gluon/globals.py", line 96, in <lambda>
>
> >>     self._caller = lambda f: f()
>
> >>   File "/version_183-2/web2py/gluon/tools.py", line 2219, in f
>
> >>     return action(*a, **b)
>
> >>   File "/version_183-2/web2py/applications/app/controllers/default.py" 
> >> <http://admin/default/edit/devGUImdg1/controllers/lotns.py>, line 17, in 
> >> create
>
> >>     if form.accepts(request.vars, session):
>
> >>   File "/version_183-2/web2py/gluon/sqlhtml.py", line 1049, in accepts
>
> >>     self.vars.id = self.table.insert(**fields)
>
> >>   File "/version_183-2/web2py/gluon/sql.py", line 2009, in insert
>
> >>     self._db._execute("select currval('%s')" % self._sequence_name)
>
> >>   File "/version_183-2/web2py/gluon/sql.py", line 1010, in <lambda>
>
> >>     self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
>
> >> OperationalError: ERREUR:  la valeur courante (currval) de la séquence « 
> >> table1_table1_id_seq » n'est pas encore définie
>
> >> dans cette session
>
> >> I use the to define my postgresql sequence name in my model that way 
> >> sequence_name='table1_table1_id_seq' for the field : 
> >> Field('table1_id','id'),
>
> >> I try to clean my app without succes, try to restart, etc.
>
> >> Thanks for any suggestion!
>
> >> Richard
>
> >> PS.: There is a problem on importation of exported csv file from the admin 
> >> interface... The id field of exported csv is : table1.table1_id that 
> >> correct, but the importation fail if I am not changing the 
> >> *table1.table1_id* header for *table1.id*

Reply via email to