ething like the following to take advantage of the index:
coallesce((SELECT idthread FROM table WHERE idsection = 'CZE' ORDER BY
idthread DESC, idsection DESC LIMT 1))+1
That's interesting and valuable, thank you very much.
--
Milos Prudek
_
Most websites are
confused c
> Actually, if you declared idmember as SERIAL PRIMARY KEY, you could
> just do:
I can't do that. idmember is a SERIAL PRIMARY KEY for members. Each
member can have many messages (msg table) with the same idmember column
value. See my original post.
--
M
Alternatively, you could rewrite this query:
"INSERT INO msg (idmember,txt) VALUES (currval('members_idmember_seq'),
%s);"
Cool. You helped me demolish 3 lines of code with no compromise in
legibility.
--
Milos Prudek
---(end of broadcast)---
ncrement fields in
> PostgreSQL - they are SEQUENCES.
I know.
So, it's the best or reasonable practice(TM), isn't it?
--
Milos Prudek
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
t;
c.execute(Cmd, Data)
Cmd = "SELECT currval('members_idmember_seq') FROM members LIMIT 1;"
c.execute(Cmd)
idmember = c.fetchone()[0]
Cmd = "INSERT INTO msg (idmember,txt) VALUES (%s,%s);"
c.execute(Cmd,(idmember,TxtData)
conn.commit()