* Pavel Stehule <pavel.stehule@gmail.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@highrise.ca command like a king,
http://www.highrise.ca/ work like a slave.