2

I'm using PHP 7.2.12 and PostgreSQL 9.5.5 and Lumen 7 when i execute a query with query builder, Lumen give me numeric column as string.

Table: 
 id: bigint 


{
  id: "1"
}

i have searched for and there is answer for MySQL but that does not work for PostgreSQL.

my co-worker does not have this problem in Linux. but i use windows 10 and i don't know what configuration have to set to fix this issue.

2
  • I have check and i see this problem is for only columns with bigint type. Commented Apr 7, 2020 at 6:35
  • It is very likely the underlying driver returns the data as text, see stackoverflow.com/questions/31643297/… Commented Apr 16, 2020 at 10:14

1 Answer 1

0

I searched a lot i found this problem is because of php does not support bigint in 32bit machine if your machine is x64 so you should check is your php x64 too or not: you can check it by following script:

echo (PHP_INT_SIZE === 8) ? "64 bit " : "32 bit ";

this problem is not PDO issue and you cann't solve it with changing PDO options it's because of pgsql driver. pgsql return bigint as string if the used language doesn't have any type for bigint.

Sign up to request clarification or add additional context in comments.

2 Comments

My machine is x64, my PHP is x64, my PostgreSQL is x64, it still return BIGINT but also INT and SMALLINT as string... :/
@Some_user if you have all int as string i think you should set PDO options to change number to integers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.