Reputation: 48587
I was just wondering if there is a specific postgres column type for regular expression patterns. That is, I want to store patterns in a column and then query for the ones that match an input string literal. Is there a better way than just making a TEXT column?
Upvotes: 4
Views: 3902
Reputation: 16714
No, there is no specific column type for storing regular expressions.
Unfortunately, you will have to actually run each regular expression on your string literal in order to find out if it's a match.
Edit I thought that a varchar column would save space but after reading @muistooshort's comment and doing some research it seems that varchar columns don't hold much benefit over text columns in postgresql. I find this amusing and a bit odd.
Upvotes: 6