Re: CONCAT function
От | scott.marlowe |
---|---|
Тема | Re: CONCAT function |
Дата | |
Msg-id | Pine.LNX.4.33.0309160819380.4190-100000@css120.ihs.com обсуждение исходный текст |
Ответ на | Re: CONCAT function ("scott.marlowe" <scott.marlowe@ihs.com>) |
Список | pgsql-general |
On Tue, 16 Sep 2003, scott.marlowe wrote: > On Tue, 16 Sep 2003, Marek Lewczuk wrote: > > > Hello, > > As I'm in the middle of the migration process form mysql to pg I found > > that there is no CONCAT function which is available in mysql. Can > > anybody tell me how to implement this function using plPERL or plPGSQL > > language ? > > What's wrong with using the SQL spec || operator? Having read the other bits of this thread now, it seems you'd like to create a simple function (pl/sql is good enough to so it, no need for pl/pgsql or what) to do this, but it needs to handle a variable number of args. While pgsql doesn't, to the best of my knowledge, support variable number of arguments, it DOES support overloading. So, you can always create a series of functions that hand 2, 3, 4, 5, 6, etc.., arguments until you get enough to handle all the situations you need. I still stand by my recommendation to start MySQL with the ansi compatibility switch and use the SQL standard specified || operator for portability, as the next database you want to port to after Postgresql may not be flexible enough to do this. Standards are nice, they improve portability, and while the default behaviour of MySQL here is not spec, at least they do provide a switch to make it work the right way. Of course, if you've got other packaged apps using || as the OR operator, you might have issues there. But, if the statements of MySQL are to be taken seriously, i have the feeling that one day || may well be deprecated as they try to get their database server more and more accepted for the server room as a replacement for other databases, so you might as well be ahead of the curve, and not caught by surprise when that happens.
В списке pgsql-general по дате отправления: