A note on the e-ikamet system for foreigners

This year for the first time I got to use the e-ikamet randevu system. It’s quite nicely done, certainly better than the old system! I found two issues with it which might help others who are struggling to get an appointment:

  1. If you mistype your father’s name in the English version of the site, when you go on to the next page everything is broken. This is because the error string is automatically generated on the server-side unfortunately not escaped properly (the apostrophe in “father’s name”). This probably happens in other places too. To fix this, switch to the Turkish version of the site as they probably tested the error messages better, and Turkish doesn’t typically use apostrophes anyway.
  2. If, after completing the process you need to get a randevu (for example, my passport number appears to be incorrectly entered into their system at present), the ‘Get a randevu’ button should not be greyed out even if there are no randevu available. If it is greyed out it means that you got something wrong on your application process, but they don’t have an error message to tell you about it. In my case, I had set the date of my health insurance to expire before the expiration date of the ikamet I was trying to get. Even though there was no error displayed, when I set the insurance date to further in the future, it allowed me to get a randevu.
  3. Another bug was that the maximum size of photo upload seems to be around 500kb – I uploaded a larger passport photo (or perhaps because it was high resolution) and it only showed the top half of my head but didn’t count this as an error. Also, it only showed this when you went back to the page after the upload; not when you first added the photo. If it only shows a partial image just resize the photo and try uploading again.

row_to_json() equivalent for jsonb types

With the advent of the awesome jsonb data type in Postgres 9.4, pretty much all of the json-related functions have a json_* and jsonb_* varient. All those, except row_to_json. I spent a bit of time but couldn’t find an answer online, in the end after a bit of experimentation, I discovered that in Postgres 9.5 at least the to_jsonb function does exactly the same, like:

SELECT to_jsonb(table.*)
FROM table