Search Postgresql Archives

Re: migrating from mysql: need to convert empty string to null

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Dave Lee" <davelee.com@xxxxxxxxx> writes:
> and I notice that there isn't any rows specified for converting
> varchar or text to int. Which raises the question, if I run:

> SELECT '123'::int;

> What conversion is actually happening here?

None.  There is no type coercion there --- what that is really
specifying is invocation of the int data type's input function
on the given string.

I don't think your approach is going to work; you would have to
make your client programs emit things like

	insert into mytab(integercol) values (''::varchar)

in order to get a runtime varchar-to-int cast to be applied.
At that point you might as well fix them properly.

			regards, tom lane


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux