arrays.out
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:2k
源码类别:

数据库系统

开发平台:

Unix_Linux

  1. QUERY: SELECT * FROM arrtest;
  2. a          |b              |c            |d                |e            |f                |g              
  3. -----------+---------------+-------------+-----------------+-------------+-----------------+---------------
  4. {1,2,3,4,5}|{{{0,0},{1,2}}}|{}           |{}               |             |{}               |{}             
  5. {11,12,23} |{{3,4},{4,5}}  |{"foobar"}   |{{"elt1","elt2"}}|{"3.4","6.7"}|{"abc  ","abcde"}|{"abc","abcde"}
  6. {}         |{3,4}          |{"foo","bar"}|{"bar","foo"}    |             |                 |               
  7. (3 rows)
  8. QUERY: SELECT arrtest.a[1],
  9.           arrtest.b[1][1][1],
  10.           arrtest.c[1],
  11.           arrtest.d[1][1],
  12.           arrtest.e[0]
  13.    FROM arrtest;
  14.  a|b|c     |d   |e
  15. --+-+------+----+-
  16.  1|0|      |    | 
  17. 11| |foobar|elt1| 
  18.   | |foo   |    | 
  19. (3 rows)
  20. QUERY: SELECT arrtest.a[1:3],
  21.           arrtest.b[1:1][1:2][1:2],
  22.           arrtest.c[1:2],
  23.           arrtest.d[1:1][1:2]
  24.    FROM arrtest;
  25. a         |b              |c            |d                
  26. ----------+---------------+-------------+-----------------
  27. {1,2,3}   |{{{0,0},{1,2}}}|             |                 
  28. {11,12,23}|               |             |{{"elt1","elt2"}}
  29.           |               |{"foo","bar"}|                 
  30. (3 rows)
  31. QUERY: SELECT array_dims(arrtest.b) AS x;
  32. x              
  33. ---------------
  34. [1:1][1:2][1:2]
  35. [1:2][1:2]     
  36. [1:2]          
  37. (3 rows)
  38. QUERY: SELECT *
  39.    FROM arrtest
  40.    WHERE arrtest.a[1] < 5 and
  41.          arrtest.c = '{"foobar"}'::_name;
  42. a|b|c|d|e|f|g
  43. -+-+-+-+-+-+-
  44. (0 rows)
  45. QUERY: SELECT arrtest.a[1:3],
  46.           arrtest.b[1:1][1:2][1:2],
  47.           arrtest.c[1:2],
  48.           arrtest.d[1:1][1:2]
  49.    FROM arrtest;
  50. a         |b              |c            |d                
  51. ----------+---------------+-------------+-----------------
  52. {1,2,3}   |{{{0,0},{1,2}}}|             |                 
  53. {11,12,23}|               |             |{{"elt1","elt2"}}
  54.           |               |{"foo","bar"}|                 
  55. (3 rows)