Question: I am trying to get a "datetime" from a csv file and insert it into MySql Database. What am I doing wrong? Thanks in advance!

```
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) 
            {
                $date = new Datetime();
                $this->date->format('Y-d-m H:i:s', ($data[3]));

                $sql = "INSERT INTO logs(ID, User, Flag, Date) values('$data[0]', '$data[1]', '$data[2]', '$data[3]')";
                $insert = $this->dataBase->getData($sql);

```

Answer: 
I ran into the same problem while building the centos 5 version of postgresql (8.2) for centos 7 (3.10.0-229.el7.x86\_64.)

I wasn't able to make it work with gcc-4.8.3 using the CFLAGS="-O1" trick, but switching to clang (3.4.2) as the compiler (CC=clang) did work for me (and it worked at the default -O2 optimization level.)
@Rhim appears to be correct - [you've hit what was assumed to be a compiler bug](http://www.postgresql.org/message-id/17948.1365090217@sss.pgh.pa.us). You might want to update to the latest gcc packages then `make clean`, re-run `configure` with `CFLAGS="-O1"` as an argument, and then re-compile.

BTW, this suggests that you are compiling PostgreSQL 8.4 or older as `pg_sync_pg_database` doesn't appear in 9.0 or newer. You must also be compiling on a newer host. As PostgreSQL 8.4 will soon be end-of-life and unsupported, this is probably not a good idea.

It also suggests you've compiled your own version rather than using packages. You should use <http://apt.postgresql.org/> rather than compiling your own unless you have a good specific reason.