添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Announcement icon Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
database system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Needs documentation about tags
Needs documentation

A documentation change is requested elsewhere. For Drupal core (and possibly other projects), once the change has been committed, this status should be recorded in a change record node.

Created:
26 May 2010 at 10:00 UTC
Updated:
22 Jul 2010 at 11:51 UTC

The "double pipe" operator is standard ANSI SQL, but it is not that well supported across the board:

  • It doesn't seem to be supported in every platforms by Oracle.
  • It is not supported at all by SQL Server, which uses + for this. We can easily replace || by + , but that breaks automatic casting to string, when mixing the types of columns in a expression (like 'The age of ' || name || ' is ' || age || '.' we use in DatabaseAnsiSyntaxTestCase::testFieldConcat() ).
  • It is not supported at all by Drizzle, which doesn't have the PIPES_AS_CONCAT SQL Mode that MySQL supports.
  • For all those reasons, I suggest we strongly advice against using the double pipe operator, and standardize on CONCAT(anyvalue, anyvalue) (with two parameters only).

    If CONCAT() is part of ANSI SQL, sounds fine to me. It should be added to the handbook page.

    Perhaps we should consider adding a link from the main docblock for the DB layer to the handbook page when it's more fleshed out.

    Comment File Size Author
    #40 pgsql_criticals_are_not_criticals.patch 1.9 KB chx
    #35 809698-pgsql-concat-funcs.patch 1.49 KB Josh Waihi
    #15 809698-concat-not-pipe_2.patch 2.41 KB tstoeckler
    #5 809698-concat-not-pipe.patch 2.42 KB Damien Tournoud