Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Activity (RSS)

Tuesday, April 02 2013
155 ZPsycopgDA getcursor() returns uninitialized connections if called from a sep... was created
  • Daniele Varrazzo
    Daniele Varrazzo created the ticket at 12:15 AM

    Manually creating a thread and calling getcursor() from there returns a cursor on a connection that didn't receive the 'init' procedure (isolation level, encodi...

Monday, March 25 2013
154 Insert with RETURNING mutilple values returns them in a string was updated
  • Daniele Varrazzo
    • State changed from new to invalid
    by Daniele Varrazzo at 9:38 AM

    That's because you have put the RETURNING values into parenthesis, so postgres is returning a record value for which psycopg doesn't have a typecaster.

    You have...

Sunday, March 24 2013
154 Insert with RETURNING mutilple values returns them in a string was created
  • Psycopg website
    Psycopg website created the ticket at 7:32 PM

    Submitted by: ChMeessen

    When performing an SQL insert operation returning multiple values, which is valid, the value returned by fetchone()[0] is a string with ...

Tuesday, March 19 2013
149 Add support for PG_DIAG_*_NAME error fields was updated
  • Daniele Varrazzo
    Daniele Varrazzo commented at 11:51 PM

    Fixed the problem: the exception now contains the PGresult. When the exception is created it takes ownership of the result, which is disposed of only when the e...

  • Daniele Varrazzo
    Daniele Varrazzo commented at 3:41 AM

    The connection is only used to get the encoding: we can store that too in the exception.

    I'm getting crazy subtyping StandardError... enough for tonight.

  • Matthew Woodcraft
    Matthew Woodcraft commented at 12:19 AM

    Thanks. One possible complication I thought of is that the Diagnostics still wants to see a connection in order to call conn_text_from_chars(); I suppose that p...

  • Daniele Varrazzo
    Daniele Varrazzo commented at 12:15 AM

    Adding PQresult to the exception requires the Error exception to have a C structure (a PsycoErrorObject): I'm taking a look at doing it, using the Python System...

Monday, March 18 2013
149 Add support for PG_DIAG_*_NAME error fields was updated
  • Daniele Varrazzo
    Daniele Varrazzo commented at 11:49 PM

    Oh well, that's true. Probably the idea of going diag->exception->cursor->PGresult is not so great after all.

    Because typically after the exception the result i...

  • Matthew Woodcraft
    Matthew Woodcraft commented at 10:26 PM

    OK.

    I think now that the problem is that, because commit is called directly on the connection, there is no cursor associated with the exception. So I'm not sure...

  • Daniele Varrazzo
    Daniele Varrazzo commented at 10:05 PM

    The test you are writing is not specific for PG 9.3: I'd drop the check for constraint_name, leave e.g. e.diag.sqlstate, which is present in all postgres versio...

  • Daniele Varrazzo
    Daniele Varrazzo commented at 10:02 PM
  • Matthew Woodcraft
    Matthew Woodcraft commented at 9:50 PM

    I think diagnostics aren't working for errors which are raised from COMMIT. I suppose the PQresult is being cleared too early, but I'm not sure where.

    This test...

6 earlier changes…
  • Daniele Varrazzo
    Daniele Varrazzo commented at 9:20 PM

    Yes, I've thought about this shortcoming. We may be more explicit in the docs. There's also a 'mark' field in the connection/cursor: not sure it's updated every...

  • Matthew Woodcraft
    Matthew Woodcraft commented at 7:51 PM

    I do have one other small worry: it's possible for a cursor to be re-used after an error, so in principle 'diag' from an existing Error object could end up repo...

  • Matthew Woodcraft
    Matthew Woodcraft commented at 7:40 PM

    Looks good to me. Perhaps it's worth saying in the docs that the PG_DIAG_*_NAME fields won't be available unless the server is PostgreSQL 9.3 or later? (Also, I...

  • Daniele Varrazzo
  • Daniele Varrazzo
    • State changed from new to resolved
    by Daniele Varrazzo at 2:26 AM

    I've reviewed the GC interaction and added documentation: this should complete the work.

    I've merged the branch into my devel to run the test with all the versi...

  • Daniele Varrazzo
    Daniele Varrazzo commented at 12:41 AM

    I've done much of the above:

    • all the attributes exposed and tested
    • test after COPY
    • test with Python 3 (decoded from conn encoding)
153 psycopg2's fix_b causing other module using build_py_2to3 to fail was updated
  • Daniele Varrazzo
    • State changed from new to resolved
    by Daniele Varrazzo at 2:26 AM

    Fixed in devel, to be released soon.

Sunday, March 17 2013
153 psycopg2's fix_b causing other module using build_py_2to3 to fail was updated
  • Kridsada Thanabulpong
    Kridsada Thanabulpong commented at 11:18 PM

    Both patch works, I can see foomod went through without any problems.

    Thanks!

  • Daniele Varrazzo
    Daniele Varrazzo commented at 11:04 PM

    What about this patch instead?

    Maybe subclassing build_py is not necessary but it doesn't hurt.

    diff --git a/setup.py b/setup.py
    index 3791c14..96cd237 100644
    ...
  • Daniele Varrazzo
    Daniele Varrazzo commented at 11:01 PM

    Ignore the above patch: the problem is the list changed inplace

  • Daniele Varrazzo
    Daniele Varrazzo commented at 10:57 PM

    Can you test if this fix works?

    diff --git a/setup.py b/setup.py
    index 3791c14..bd0a8f3 100644
    --- a/setup.py
    +++ b/setup.py
    @@ -55,10 +55,14 @@ from distutils...
  • Daniele Varrazzo
    Daniele Varrazzo commented at 10:48 PM

    Is there a different way to customize the list of fixers which wouldn't suffer of the shortcoming?

1 earlier change…
  • Kridsada Thanabulpong
    Kridsada Thanabulpong created the ticket at 10:01 PM

    psycopg2 monkey-patching of lib2to3.refactor (setup.py line 65) is causing any module that rely on build_py_2to3 to fail if it installs after psycopg2 (i.e. as ...

149 Add support for PG_DIAG_*_NAME error fields was updated
  • Matthew Woodcraft
    Matthew Woodcraft commented at 9:45 PM

    I hope to do some more work on it tomorrow. But of course I won't have any complaints if you fix things yourself.

  • Daniele Varrazzo
    Daniele Varrazzo commented at 7:38 PM

    Thank you very much, great work.

    I've only included the five new 'enhanced error fields', but it should be easy enough 
    to add properties for the other PG_DIAG...
  • Matthew Woodcraft
    Matthew Woodcraft commented at 5:14 PM

    Ok, I've pushed it to a 2013-03-17_diagnostics branch in mattheww/psycopg2 on github:
    https://github.com/mattheww/psycopg2/tree/2013-03-17_diagnostics

    It's base...

  • Daniele Varrazzo
    Daniele Varrazzo commented at 4:31 PM

    Great! Please push it on github.

  • Matthew Woodcraft
    Matthew Woodcraft commented at 3:15 PM

    I have something basically working now, using the design you described. If you like I'll publish what I've got so you can judge whether it looks suitable, and h...

2 earlier changes…
  • Daniele Varrazzo
    Daniele Varrazzo commented at 2:51 PM

    Are you planning to work on that in the next days? Because I'd like to release 2.5 soon, the code is actually ready. But I can wait a few days if you want to ad...

  • Matthew Woodcraft
    Matthew Woodcraft commented at 11:48 AM

    Ok, that makes sense. I will have a go at writing it that way.

Saturday, March 16 2013
149 Add support for PG_DIAG_*_NAME error fields was updated
  • Daniele Varrazzo
    Daniele Varrazzo commented at 5:44 PM

    The exception already contains a pointer to the cursor, hence it can reach the PQresult.

    If we need to keep the PQresult upon error longer than we currently do ...

148 memory leak if connection is closed actively by pg server was updated
  • Daniele Varrazzo
    • State changed from open to resolved
    by Daniele Varrazzo at 3:14 PM

    Fixed in devel branch

150 Test failures about NOTICE messages on unreleased Postgres 9.3 was updated
  • Daniele Varrazzo
    • State changed from open to resolved
    by Daniele Varrazzo at 12:56 AM

    Pushed to devel, thank you.

Friday, March 15 2013
150 Test failures about NOTICE messages on unreleased Postgres 9.3 was updated
  • Daniele Varrazzo
    Daniele Varrazzo commented at 5:21 PM

    ♥

  • Catalin Iacob
    Catalin Iacob commented at 5:13 PM

    Correct patch now. I attached the wrong file in previous message (and deleted it now to avoid confusion).

  • Catalin Iacob
    Catalin Iacob commented at 5:06 PM

    Actually, I checked instead of just reasoning about it and I was wrong, the alternative also works.

    The notices get counted only for tables that don't have prim...

  • Daniele Varrazzo
    • State changed from new to open
    by Daniele Varrazzo at 4:48 PM

    I see, thank you for the tests. I'll commit your test suite patch for the next release.

  • Catalin Iacob
    Catalin Iacob commented at 4:42 PM

    They couldn't stay completely unchanged. With debug1 I get an extra message (building index...) so at least the test that counts the notices would need changes:

    ...
1 earlier change…
  • Daniele Varrazzo
    Daniele Varrazzo commented at 11:37 AM

    Thank you, I'll look into the issue.

    Out of curiosity, wouldn't have been the same to add on top of the failing tests something like:

    if postgres_version >= 9....
Thursday, March 14 2013
150 Test failures about NOTICE messages on unreleased Postgres 9.3 was created
  • Catalin Iacob
    Catalin Iacob created the ticket at 9:24 PM

    Some tests related to NOTICE messages fail with Posgres 9.3 (compiled from Git a few days ago).

    The failures happen because statements like: create temp table c...

Saturday, March 09 2013
149 Add support for PG_DIAG_*_NAME error fields was updated
  • Matthew Woodcraft
    Matthew Woodcraft commented at 9:18 PM

    Last summer, when an earlier version of this Postgres patch was being considered, I had a look at adding support in Psycopg.

    If you haven't started work on this...

Monday, February 25 2013
149 Add support for PG_DIAG_*_NAME error fields was updated
  • Masklinn
    Masklinn commented at 1:36 PM

    I'd avoid a mapping as I don't want to query everything on object creation, only on attribute access.

    That can also be done on mappings FWIW, but if it's goin...

  • Daniele Varrazzo
    Daniele Varrazzo commented at 11:33 AM

    Oh, I thought PQresultErrorField was a new api. This makes things easier.

    I'd avoid a mapping as I don't want to query everything on object creation, only on at...

  • Masklinn
    Masklinn commented at 10:56 AM

    It's actually interesting. What I'd do is to add a diag attribute to the exception, that could be used to fetch the relevant attribute, something like:

    That's...

Friday, February 22 2013
149 Add support for PG_DIAG_*_NAME error fields was updated
  • Daniele Varrazzo
    Daniele Varrazzo commented at 10:17 AM

    It's actually interesting. What I'd do is to add a diag attribute to the exception, that could be used to fetch the relevant attribute, something like:

    try:
      ...
  • Psycopg website
    Psycopg website created the ticket at 9:21 AM

    Submitted by: masklinn

    While not released yet, Postgres 9.3 (to be released in September 2013?) will apparently add a number of error fields useful for programm...

Sunday, February 17 2013
148 memory leak if connection is closed actively by pg server was updated
  • Daniele Varrazzo
    • State changed from new to open
    by Daniele Varrazzo at 8:59 AM

    Thank you for the report and the analysis: we'll look into that.

  • Psycopg website
    Psycopg website created the ticket at 2:54 AM

    Submitted by: reno.gan@gmail.com

    In our environment, every client connection has a max idle time. If this time expires, pg server will disconnect its connection...