添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
火爆的薯片  ·  ibm mq - ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams What does " not working " mean? Do you get an error? If yes which one. Also: both 9.3 and 8.4 are no longer supported. Especially 8.4 is really, really outdated. You should plan an upgrade for both environments now a_horse_with_no_name Dec 19, 2018 at 8:22 I cant upgrade - this is shared hosting. Query not return result. Is v 8.4 support LIKE CONCAT Бисер Стоилов Dec 19, 2018 at 8:26

In PostgreSQL version 8.4 to String concatenation use || operation.

Example: 'Post' || 'greSQL'

Result is: PostgreSQL

You could also use WS_CONCAT function but it is not defined in 8.4. You can declare it as the following:

CREATE OR REPLACE FUNCTION concat_ws(
   separator text,
   VARIADIC names_array text[]
RETURNS text
LANGUAGE plpgsql
AS $$
BEGIN
    RETURN array_to_string(array_remove(names_array, NULL), ' ');

This definition works exactly as in 9.x and above: pass the separator text first and then an arbitrary amount of texts to concat. NULL values get filtered out.

Example:

SELECT WS_CONCAT(' ', 'Ford', 'Focus', NULL /* Missing body-style */, '1.8 L')

Result: Ford Focus 1.8 L

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.