Revision 3060
Added by Aaron Marcuse-Kubitza about 12 years ago
lib/sql_gen.py | ||
---|---|---|
572 | 572 |
|
573 | 573 |
row_count = CustomCode('count(*)') |
574 | 574 |
|
575 |
coalesce = InternalFunction('COALESCE') |
|
576 |
|
|
575 | 577 |
# See <http://www.postgresql.org/docs/8.3/static/datatype-numeric.html> |
576 | 578 |
null_sentinels = { |
577 | 579 |
'character varying': r'\N', |
... | ... | |
583 | 585 |
|
584 | 586 |
class EnsureNotNull(FunctionCall): |
585 | 587 |
def __init__(self, value, type_): |
586 |
FunctionCall.__init__(self, InternalFunction('COALESCE'), as_Col(value),
|
|
588 |
FunctionCall.__init__(self, coalesce, as_Col(value),
|
|
587 | 589 |
Cast(type_, null_sentinels[type_])) |
588 | 590 |
|
589 | 591 |
self.type = type_ |
Also available in: Unified diff
sql_gen.py: Added coalesce and use it in EnsureNotNull