in reply to Perl and PostgreSQL regex
Try changing your expression to:
$sth_get_branch_list = $dbh->prepare(q( SELECT branch FROM postgres_database WHERE tree = 'first_tree' AND branch ~ '$root\.\d+'; ));
(You don't use slashes for regular expressions in PostgreSQL, see http://www.postgresql.org/docs/8.3/static/functions-matching.html and http://www.oreillynet.com/pub/a/databases/2006/02/02/postgresq_regexes.html.)
Update: Since I don't use PostgreSQL, there are probably other differences as well.
Update 2: In this case, you really don't need regular expressions anyway, you could use:
...roboticus$sth_get_branch_list = $dbh->prepare(q( SELECT branch FROM postgres_database WHERE tree = 'first_tree' AND branch like '$root%'; ));
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl and PostgreSQL regex
by chrishowe (Acolyte) on Mar 03, 2009 at 13:49 UTC |