| From: | Aidan Van Dyk <aidan(at)highrise(dot)ca> | 
|---|---|
| To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> | 
| Cc: | Hannu Krosing <hannu(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: RfD: more powerful "any" types | 
| Date: | 2009-09-10 20:33:38 | 
| Message-ID: | 20090910203338.GG3488@oak.highrise.ca | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
* Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> [090910 16:16]:
 
> first is coming from C and has C semantic - there is only one possible
> tag (without binary compatible types) - you cannot use %s for numbers,
> and %d for strings is some specific value.
> 
> sprintf("%d", "10") - show address of static string "10"
> 
> second is Tom's proposal. More dynamic. Tag specify target type.
> 
> so sprintf('%d', '10') show 10 with possible width manipulation operations
Just to make the task that much harder, if PostgreSQL is going to have a
sprintf (in core, or contrib), I *really* hope it's a real sprintf,
supporting everything, like:
   $m positional notation
   * width argument
   All the flags [#0- +'] (I as a bonus)
   field width . presision 
And you're going to want to make sure you support all the regular
conversion specifiers (d/i/o/u/x/X/e/E/f/F/g/G/p/n/c/s)...
How to deal with types conflicting with the conversion specifier is
going to be something necessary to look at (And just crashing a-la-C
probably isn't nice).
If you're making sprintf, then it's going to need to be C-like, and it's
going to be a lot of tedious conversion/formating...  Of course, I'ld
love to see it, because I can forever then forget about all that tedious
formatting in PosgreSQL...
a.
-- 
Aidan Van Dyk                                             Create like a god,
aidan(at)highrise(dot)ca                                       command like a king,
http://www.highrise.ca/                                   work like a slave.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Hannu Krosing | 2009-09-10 20:38:25 | Re: RfD: more powerful "any" types | 
| Previous Message | Dimitri Fontaine | 2009-09-10 20:33:05 | Re: RfD: more powerful "any" types |