Re: Regex on field value
On 04/14/2018 02:06 PM, David G. Johnston wrote: On Saturday, April 14, 2018, Mike Martin> wrote: Is this possible, eg Substring(field, regex include other field name) Something like?: select substring(link_key from '^' || c_id ), link_key, c_id from projection where link_key != 'no_key' limit 10; substring | link_key | c_id ---+-+ 6RPLF | 6RPLF-1646 | 6RPLF 6RPLF | 6RPLF-1646 | 6RPLF 6RPLF | 6RPLF-1646 | 6RPLF 6RPLF | 6RPLF-1646 | 6RPLF 4RPLF | 4RPLF-1694 | 4RPLF 10CEHB| 10CEHB-2628 | 10CEHB 10CEHB| 10CEHB-2628 | 10CEHB 10CEHB| 10CEHB-2628 | 10CEHB 10CEHB| 10CEHB-1698 | 10CEHB 1GPLF | 1GPLF-1704 | 1GPLF (10 rows) Your example doesn't make sense but if you are asking whether a regular expression can be stored in a column the answer is yes - though it's nothing but a text value with runtime limitations. David J. -- Adrian Klaver adrian.kla...@aklaver.com
Re: Regex on field value
On Saturday, April 14, 2018, Mike Martinwrote: > Is this possible, eg > Substring(field, regex include other field name) > Your example doesn't make sense but if you are asking whether a regular expression can be stored in a column the answer is yes - though it's nothing but a text value with runtime limitations. David J.
Regex on field value
Is this possible, eg Substring(field, regex include other field name) Thanks
Re: cursor "x" does not exist
On 04/14/2018 09:36 AM, Bob Jones wrote: On 14 April 2018 at 16:38, Tom Lanewrote: Bob Jones writes: My apologies if I'm being incredibly stupid here, but I've reviewed what the docs have to say about naming portals and I still can't see where I'm going wrong here ? I think you're forgetting to double-quote an upper case identifier. FETCH ALL IN B; ERROR: cursor "b" does not exist The cursor is named "B" not "b", but B without quotes folds to the latter. regards, tom lane Thank you tom for showing me the error in my ways. Now where's that dunce cap gone ? Maybe I don't deserve to use anything better than MySQL. ;-) Or read the below and be illuminated:) https://www.postgresql.org/docs/10/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS -- Adrian Klaver adrian.kla...@aklaver.com
Re: cursor "x" does not exist
On 14 April 2018 at 16:38, Tom Lanewrote: > Bob Jones writes: >> My apologies if I'm being incredibly stupid here, but I've reviewed >> what the docs have to say about naming portals and I still can't see >> where I'm going wrong here ? > > I think you're forgetting to double-quote an upper case identifier. > >> FETCH ALL IN B; >> ERROR: cursor "b" does not exist > > The cursor is named "B" not "b", but B without quotes folds to the latter. > > regards, tom lane Thank you tom for showing me the error in my ways. Now where's that dunce cap gone ? Maybe I don't deserve to use anything better than MySQL. ;-)
Re: cursor "x" does not exist
Bob Joneswrites: > My apologies if I'm being incredibly stupid here, but I've reviewed > what the docs have to say about naming portals and I still can't see > where I'm going wrong here ? I think you're forgetting to double-quote an upper case identifier. > FETCH ALL IN B; > ERROR: cursor "b" does not exist The cursor is named "B" not "b", but B without quotes folds to the latter. regards, tom lane