SQLite will invent a name if none is provided in the AS clause. One should not rely on names invented by SQLite, they may change between releases. What return value did you expect for a NULL statement pointer or an out of range column index, given that the function returns const char*?