Bug #4972

array PHP <-> Pg conversion is broken

Added by Álvaro Herrera 11/23/2005 (about 16 years) ago. Updated 05/21/2011 (over 10 years) ago.

Status:In ProgressStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Resolution:

Description

Element parsing in arrays can easily be confused. Test case:

create or replace function another_text_test(text[], int)
returns text language plphp as $$ return $argsr0[$argsr1]; $$;

Strings should be quoted before passing them to PHP, so the NOTICE from PHP here is bogus:

pl_regression=# select another_text_test($${"foo",'bar', "{"}$$, 0);
NOTICE:  plphp: Use of undefined constant foo - assumed 'foo'
 another_text_test 
-------------------
 foo
(1 fila)

The same reason causes this to "eat" the inner level of quotes:

pl_regression=# select another_text_test($${"'bar'", "{"}$$, 0);
 another_text_test 
-------------------
 bar
(1 fila)

Note particularly this totally unexpected behavior:

pl_regression=# select another_text_test($${"'bar'", "{"}$$, 1);
 another_text_test 
-------------------
 array(
(1 fila)

History

#1 Updated by Álvaro Herrera 01/16/2008 (about 14 years) ago

  • Status changed from New to In Progress

#2 Updated by Álvaro Herrera 03/12/2010 (almost 12 years) ago

  • Assignee deleted (Álvaro Herrera)

#3 Updated by Álvaro Herrera 05/21/2011 (over 10 years) ago

  • Priority changed from Low to Normal

Also available in: Atom PDF