Simple but frustrating issue... I'm trying to do an update command to correct a misspelling with this field:
grouper=> select * from master_list WHERE group ~ 'JustAdopted';
group | activity | usefulness
-------------------+----------+------------
JustAdoptedAdvice+| |
| |
(1 row)
But postgres won't give me a straight answer on the field name...
grouper=> UPDATE master_list SET group = 'JustAdoptingAdvice' WHERE group = 'JustAdoptedAdvice';
UPDATE 0
grouper=> UPDATE master_list SET group = 'JustAdoptingAdvice' WHERE group = 'JustAdoptedAdvice+';
UPDATE 0
grouper=> select * from master_list WHERE group ~ '+';
ERROR: invalid regular expression: quantifier operand invalid
What is going on with that field? Why is that plus symbol there and what does it represent?
And how do I reference it to change it, if the field won't update with or without the symbol being there?
~
uses regular expressions to compare values. and'+'
is an invalid regular expression (which is what the error message is telling you). – a_horse_with_no_name Jan 22 '14 at 22:39+
sign? Details about regular expressions can be found here: postgresql.org/docs/current/static/… and here: regular-expressions.info – a_horse_with_no_name Jan 22 '14 at 22:42~ '+'
, but~ '\+$'
. In this case simpler to use an SQLLIKE
pattern, e.g.LIKE '%+'
. But actually the problem has nothing to do with ending with a plus, you're being thrown by howpsql
is displaying the value. See my answer. – Craig Ringer Jan 23 '14 at 3:30