SQL question

2023-01-14 Thread hamann . w
Hi, I have atable with a "name" column, and I order it usually order by regexp_match(name, 'regex1'), regexp_match(name, 'regex2') orthe equivalent order by (regexp_match(name, 'regex1'))[1], (regexp_match(name, 'regex2'))[2] Is there a wayto create a function so the statement could read select

trouble writing plpgsql

2022-12-22 Thread hamann . w
Hi, I want to make a function to parsetext and return key-value pairs create or replace function extractinfo (text) returns table (key char[1], val text) language plpgsql as $$ I first tried declare xx record; begin xx.key = ; xx.val = ; return next xx: This is not possible bec

SQL questiom

2022-01-21 Thread hamann . w
Hi, I am using a query pretty often that looks like SELECT <> WHERE <> AND <> Is there a way (with sql or plpgsql) to convert that into SELECT myquery('<>') Kind regards Wolfgang Hamann

unicode match normal forms

2021-05-17 Thread hamann . w
Hi, in unicode letter ä exists in two versions - linux and windows use a composite whereas macos prefers the decomposed form. Is there any way to make a semi-exact match that accepts both variants? This question is not about fulltext but about matching filenames across a network - I wish to av

Re: How to use full-text search URL parser to filter query results by domain name?

2019-04-06 Thread hamann . w
>> I am trying to understand how to use the full-text search parser for >> URLS and hostnames to filter results from a text field containing URLS >> based on domain, and also how to index text columns for fast >> lookup/matching based on domain. >> >> I have a PostgreSQL database containing documen

data definition within plpgsql

2019-01-28 Thread hamann . w
Hi, I tried this code (to be inserted within a larger psql script) do $_$ declare next int; begin select max(id) + 1 into next from items; execute 'create temp sequence tmp_ids start $1' using next; end $_$ language plpgsql; but that reports a syntax error near $1. Wha

Re: conditionally terminate psql script

2018-12-17 Thread hamann . w
Hi, many thanks, I will give it a try tomorrow Best regards Wolfgang >> >> On 17.12.2018 16:07, haman...@t-online.de wrote: >> > Hi, many thanks -- too bad I am still using 9.3 >> >> In this case you can try ON_ERROR_STOP psql variable. >> Something like this: >> >> \set ON_ERROR_STOP on >> >> d

Re: conditionally terminate psql script

2018-12-17 Thread hamann . w
Hi, many thanks -- too bad I am still using 9.3 Best regards Wolfgang >> Hi >> >> po 17. 12. 2018 v 13:14 odesílatel napsal: >> >> > >> > >> > Hi, >> > >> > is there a way to stop execution of a psql script if a select returns some >> > rows (or no rows) >> > The idea is to add a safety check o

conditionally terminate psql script

2018-12-17 Thread hamann . w
Hi, is there a way to stop execution of a psql script if a select returns some rows (or no rows) The idea is to add a safety check on data, specifically to select all new rows that would conflict on a bulk insert, show them and stop Best regards Wolfgang

libpq.dll question

2018-10-01 Thread hamann . w
Hi, admitting that windows is quite alien to me... I have installed a postgresql server on linux and now want to allow windows clients access through a tcl gui. Activestate tcl is installed, and when I try to package require tdbc::postgresql I get a complaint about libpq.dll.5 missing. The post

Re: sql questions

2018-07-20 Thread hamann . w
>> Zitat von haman...@t-online.de: >> >> > a) I am running some select query >> > select ... order by >> > Now, I would like to preserver the ordering through further >> > processing by adding a sequence number >> > Of course I can do: >> > create temp sequence mseq; >> > select xx.*, ne

sql questions

2018-07-20 Thread hamann . w
Hi, a) I am running some select query select ... order by Now, I would like to preserver the ordering through further processing by adding a sequence number Of course I can do: create temp sequence mseq; select xx.*, nextval('mseq') as ord from (select ... order by ) xx; drop sequence

Re: Control PhoneNumber Via SQL

2018-05-15 Thread hamann . w
>> Hi, >> >> Sorry for asking question again. >> >> I would like to know if it is possible to control the phone number in SQL >> before inserting it to the destination DB? >> >> I have a model in Django: >> >> class BasePerson(TimeStampedModel): >> phone_number = PhoneNumberField(max_length=50