Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2012
    Posts
    3

    Unanswered: Insert data size limit from PHP PDO

    Apache 2.2, PHP 5.3.4, Zend Db 1.11.11, PostgreSQL 9.0.4

    I am porting an application from MySQL to PGSQL using PHP with Zend Db / PDO for database abstraction.

    My application enters a geometry column using the ST_GeomFromText() function.

    With a small number of vertices this works fine but when a polygon has too many vertices PHP crashes.

    I have captured the insert statement and run it via pgAdmin III and that works fine. Since the problem only occurs once the polygon has sufficient vertices, I assume that there is some limit being applied either to the length of the expression or to the size of the data / insert query but this limit is only being applied via the client connection from PHP since running the same insert on pgAdmin works.

    Does anyone know what limit I'm hitting and if there are any runtime configuration settings I can set in my PHP to increase it?

    Thanks. Dan

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    If it works fine in pgAdmin and the query "crashes" PHP (whatever that means) this seems to be a PHP issue rather than a Postgres issue to me.

    You should take this question to a PHP forum.

  3. #3
    Join Date
    Jan 2012
    Posts
    3

    PHP or PGSQL?

    Quote Originally Posted by shammat View Post
    If it works fine in pgAdmin and the query "crashes" PHP (whatever that means) this seems to be a PHP issue rather than a Postgres issue to me.

    You should take this question to a PHP forum.
    When I say crashes PHP I mean I get a connection reset error and apache restarts so PHP can't report what went wrong.

    The reason I post it here rather than on a PHP forum is that it seems like it might be caused by a configuration option on the PG client connection since smaller queries work fine.

  4. #4
    Join Date
    May 2008
    Posts
    277
    What shammat says is likely sound: if it's working in a different client, the problem is not with PostgreSQL. However:

    * Post your actual query here, maybe someone can find something wrong with it.

    * Try your query using PHP's PostgreSQL extension. If that works, then it's likely a PDO issue.

  5. #5
    Join Date
    Jan 2012
    Posts
    3

    Native query and running with PHP pgsql extension.

    Thanks Shammat and Futurity.

    Quote Originally Posted by futurity View Post
    * Post your actual query here, maybe someone can find something wrong with it.
    Code:
    INSERT INTO s2_site_boundary (s2_site_id,review_date,boundary,version) VALUES (1,'2012-01-26',st_geomfromtext('POLYGON((-2.022588 53.397066,-2.019976 53.39693,-2.017444 53.396525,-2.015068 53.395863,-2.01292 53.394965,-2.011066 53.393857,-2.009563 53.392574,-2.008455 53.391154,-2.007776 53.38964,-2.007547 53.38808,-2.007775 53.386519,-2.008453 53.385005,-2.009561 53.383585,-2.011063 53.382302,-2.012916 53.381193,-2.015062 53.380294,-2.017437 53.379632,-2.019968 53.379226,-2.022578 53.379089,-2.025188 53.379225,-2.02772 53.37963,-2.030095 53.380292,-2.032242 53.38119,-2.034096 53.382297,-2.0356 53.38358,-2.036709 53.385,-2.037389 53.386513,-2.037618 53.388074,-2.037391 53.389635,-2.036714 53.391148,-2.035608 53.392569,-2.034105 53.393853,-2.032253 53.394961,-2.030106 53.39586,-2.027731 53.396523,-2.025199 53.396929,-2.022588 53.397066,-2.022588 53.397066,-2.022588 53.397066))',4326),1.1);
    Quote Originally Posted by futurity View Post
    * Try your query using PHP's PostgreSQL extension. If that works, then it's likely a PDO issue.
    I have tried that and it does work so it does appear to be an issue with Zend_Db / PDO but I was hoping it may be a default configuration setting I could override rather than an error in the pdo_pgsql extension.

    Cheers. Dan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •