Re: Problem with the default registration of the JSON adapter

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: Federico Di Gregorio <federico(dot)digregorio(at)dndg(dot)it>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: Problem with the default registration of the JSON adapter
Date: 2013-07-22 16:13:53
Message-ID: BA764249-F0F4-4572-90B1-2D3804583620@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg


On Jul 22, 2013, at 9:06 AM, Federico Di Gregorio wrote:

> Looking forward, I'd say that if a type has only one useful
> representation, that one should be used; but if it has multiple useful
> representations the *simplest* one should be the default.

I have to say that I find the current situation pleasing: psycopg2 does the most natural thing with the type (converts it to a data structure, which is after all what json is encoding) if you ask for the base type. If you want the text version, just cast it to the text version in the query, and that's what you get, parallel with every other type.

--
-- Christophe Pettus
xof(at)thebuild(dot)com

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Frank Millman 2013-07-31 14:08:09 Problem with memoryview
Previous Message Federico Di Gregorio 2013-07-22 16:06:09 Re: Problem with the default registration of the JSON adapter