Re: How to add explicit types so I can use OVERLAPS?

Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization initd.org
Message-ID <[email protected]>
Il giorno ven, 01/08/2008 alle 16.49 -0400, Phillip Frost ha scritto:
> I'd be opposed to a patch that made this the default behavior, because  
> I have already some queries with things such as "timestamp %s" and so  
> on. If psycopg added the "timestamp" bit for me I'd get syntax errors.  
> Using CAST syntax might not cause a syntax error but could potentially  
> change the semantics of my queries.
> 
> I think it would also run counter to the spirit of the SQL language. I  
> think it's a frequently misunderstood fact that quoting something in  
> SQL does not make it a string; it is a literal value of unknown type.  
> The type can later be inferred (or coerced) as needed to match the  
> type of other operands, which may be defined by tables, etc. It's nice  
> to have the freedom to explicitly state the type of a literal or leave  
> it up to coercion when writing a query.
> 
> That said, it's not hard to replace the adapter for datetime objects  
> to insert the "timestamp" prior to the quoted value if that is more  
> useful for your application. Please just don't do this for me.

I understand but here we have a problem: psycopg already worked out of
the box. Now we have "errors" in queries that with PostgreSQL 8.2 where
ok. psycopg is not supposed to send to the backend "unknown" values. It
is supposed to send values of the right type. Untill now using
PostgreSQL intrinsic ability to convert a quoted string to the right
type worked. If it does not work anymore it should be fixed.

Anyway, I'll make sure to fix this maintaining backward compatibility. I
won't just stick in typecasts from the next release.
 
federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                [email protected]
INIT.D Developer                                           fog-NGVKUo/i/[email protected]
              All programmers are optimists. -- Frederick P. Brooks, Jr.

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEABECAAYFAkiTf2sACgkQvcCgrgZGjet1QgCfUW900GxkGtkAS4VNyVDtg+tD
zS8AmweWj2cKNI136DfYmQ27ULVsY7sk
=AvHR
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.