~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to doc/src/sgml/html/citext.html

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-06-14 09:53:29 UTC
  • mto: (6.1.1 sid) (10.1.1 oneiric-proposed) (1.2.1)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20110614095329-71gfhjywyp2c27au
Tags: upstream-9.1~beta2
ImportĀ upstreamĀ versionĀ 9.1~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
REV="MADE"
10
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
11
11
REL="HOME"
12
 
TITLE="PostgreSQL 9.1beta1 Documentation"
 
12
TITLE="PostgreSQL 9.1beta2 Documentation"
13
13
HREF="index.html"><LINK
14
14
REL="UP"
15
15
TITLE="Additional Supplied Modules"
26
26
HTTP-EQUIV="Content-Type"
27
27
CONTENT="text/html; charset=ISO-8859-1"><META
28
28
NAME="creation"
29
 
CONTENT="2011-04-27T21:20:33"></HEAD
 
29
CONTENT="2011-06-09T23:44:43"></HEAD
30
30
><BODY
31
31
CLASS="SECT1"
32
32
><DIV
44
44
VALIGN="bottom"
45
45
><A
46
46
HREF="index.html"
47
 
>PostgreSQL 9.1beta1 Documentation</A
 
47
>PostgreSQL 9.1beta2 Documentation</A
48
48
></TH
49
49
></TR
50
50
><TR
127
127
><H2
128
128
CLASS="SECT2"
129
129
><A
130
 
NAME="AEN128612"
 
130
NAME="AEN128708"
131
131
>F.7.1. Rationale</A
132
132
></H2
133
133
><P
201
201
    like <TT
202
202
CLASS="TYPE"
203
203
>text</TT
204
 
>, which means that the comparison of upper case and
 
204
>, which means that the matching of upper case and
205
205
    lower case characters is dependent on the rules of
206
 
    the <TT
 
206
    the database's <TT
207
207
CLASS="LITERAL"
208
208
>LC_CTYPE</TT
209
 
> locale setting. Again, this behavior is
 
209
> setting. Again, this behavior is
210
210
    identical to the use of <CODE
211
211
CLASS="FUNCTION"
212
212
>lower</CODE
220
220
><H2
221
221
CLASS="SECT2"
222
222
><A
223
 
NAME="AEN128637"
 
223
NAME="AEN128733"
224
224
>F.7.2. How to Use It</A
225
225
></H2
226
226
><P
264
264
><H2
265
265
CLASS="SECT2"
266
266
><A
267
 
NAME="AEN128645"
 
267
NAME="AEN128741"
268
268
>F.7.3. String Comparison Behavior</A
269
269
></H2
270
270
><P
 
271
>   <TT
 
272
CLASS="TYPE"
 
273
>citext</TT
 
274
> performs comparisons by converting each string to lower
 
275
   case (as though <CODE
 
276
CLASS="FUNCTION"
 
277
>lower</CODE
 
278
> were called) and then comparing the
 
279
   results normally.  Thus, for example, two strings are considered equal
 
280
   if <CODE
 
281
CLASS="FUNCTION"
 
282
>lower</CODE
 
283
> would produce identical results for them.
 
284
  </P
 
285
><P
271
286
>   In order to emulate a case-insensitive collation as closely as possible,
272
287
   there are <TT
273
288
CLASS="TYPE"
274
289
>citext</TT
275
 
>-specific versions of a number of the comparison
 
290
>-specific versions of a number of string-processing
276
291
   operators and functions.  So, for example, the regular expression
277
292
   operators <TT
278
293
CLASS="LITERAL"
284
299
   applied to <TT
285
300
CLASS="TYPE"
286
301
>citext</TT
287
 
>: they both compare case-insensitively.
 
302
>: they both match case-insensitively.
288
303
   The same is true
289
304
   for <TT
290
305
CLASS="LITERAL"
310
325
CLASS="LITERAL"
311
326
>!~~*</TT
312
327
>. If you'd like to match
313
 
   case-sensitively, you can always cast to <TT
 
328
   case-sensitively, you can cast the operator's arguments to <TT
314
329
CLASS="TYPE"
315
330
>text</TT
316
 
> before comparing.
 
331
>.
317
332
  </P
318
333
><P
319
334
>   Similarly, all of the following functions perform matching
400
415
><H2
401
416
CLASS="SECT2"
402
417
><A
403
 
NAME="AEN128687"
 
418
NAME="AEN128787"
404
419
>F.7.4. Limitations</A
405
420
></H2
406
421
><P
411
426
>      <TT
412
427
CLASS="TYPE"
413
428
>citext</TT
414
 
>'s behavior depends on
 
429
>'s case-folding behavior depends on
415
430
      the <TT
416
431
CLASS="LITERAL"
417
432
>LC_CTYPE</TT
418
433
> setting of your database. How it compares
419
 
      values is therefore determined when
420
 
      <SPAN
421
 
CLASS="APPLICATION"
422
 
>initdb</SPAN
423
 
> is run to create the cluster. It is not truly
 
434
      values is therefore determined when the database is created.
 
435
      It is not truly
424
436
      case-insensitive in the terms defined by the Unicode standard.
425
437
      Effectively, what this means is that, as long as you're happy with your
426
438
      collation, you should be happy with <TT
434
446
></LI
435
447
><LI
436
448
><P
 
449
>      As of <SPAN
 
450
CLASS="PRODUCTNAME"
 
451
>PostgreSQL</SPAN
 
452
> 9.1, you can attach a
 
453
      <TT
 
454
CLASS="LITERAL"
 
455
>COLLATE</TT
 
456
> specification to <TT
 
457
CLASS="TYPE"
 
458
>citext</TT
 
459
> columns or data
 
460
      values.  Currently, <TT
 
461
CLASS="TYPE"
 
462
>citext</TT
 
463
> operators will honor a non-default
 
464
      <TT
 
465
CLASS="LITERAL"
 
466
>COLLATE</TT
 
467
> specification while comparing case-folded strings,
 
468
      but the initial folding to lower case is always done according to the
 
469
      database's <TT
 
470
CLASS="LITERAL"
 
471
>LC_CTYPE</TT
 
472
> setting (that is, as though
 
473
      <TT
 
474
CLASS="LITERAL"
 
475
>COLLATE "default"</TT
 
476
> were given).  This may be changed in a
 
477
      future release so that both steps follow the input <TT
 
478
CLASS="LITERAL"
 
479
>COLLATE</TT
 
480
>
 
481
      specification.
 
482
     </P
 
483
></LI
 
484
><LI
 
485
><P
437
486
>       <TT
438
487
CLASS="TYPE"
439
488
>citext</TT
466
515
>lower</CODE
467
516
> function when you need to compare
468
517
      case-insensitively; this works all right if case-insensitive comparison
469
 
      is needed only infrequently.  If you need case-insensitive most of
470
 
      the time and case-sensitive infrequently, consider storing the data
 
518
      is needed only infrequently.  If you need case-insensitive behavior most
 
519
      of the time and case-sensitive infrequently, consider storing the data
471
520
      as <TT
472
521
CLASS="TYPE"
473
522
>citext</TT
475
524
CLASS="TYPE"
476
525
>text</TT
477
526
>
478
 
      when you want case-sensitive comparison.  In either situation, you
479
 
      will need two indexes if you want both types of searches to be fast.
 
527
      when you want case-sensitive comparison.  In either situation, you will
 
528
      need two indexes if you want both types of searches to be fast.
480
529
    </P
481
530
></LI
482
531
><LI
492
541
CLASS="LITERAL"
493
542
>public</TT
494
543
>);
495
 
      if it is not, a normal case-sensitive <TT
 
544
      if it is not, the normal case-sensitive <TT
496
545
CLASS="TYPE"
497
546
>text</TT
498
 
> comparison
499
 
      is performed.
 
547
> operators
 
548
      will be invoked instead.
500
549
    </P
501
550
></LI
502
551
></UL
506
555
><H2
507
556
CLASS="SECT2"
508
557
><A
509
 
NAME="AEN128714"
 
558
NAME="AEN128823"
510
559
>F.7.5. Author</A
511
560
></H2
512
561
><P