> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# CITEXT

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

The `CITEXT` <InternalLink path="data-types">data type</InternalLink> represents a case-insensitive string. Like `STRING` values, `CITEXT` values preserve their casing when stored and retrieved. Unlike `STRING` values, comparisons between `CITEXT` values are case-insensitive for all [Unicode characters](https://en.wikipedia.org/wiki/List_of_Unicode_characters) that have a defined uppercase/lowercase mapping (e.g., `'É' = 'é'`).

Equality operators (`=`, `!=`, `<>`) and ordering operators (`<`, `>`, etc.) treat `CITEXT` values as case-insensitive by default. Refer to the [example](#example).

<Tip>
  `CITEXT` compares values as a `STRING` column with the `und-u-ks-level2` <InternalLink path="collate">collation</InternalLink>, meaning it is case-insensitive but accent-sensitive.
</Tip>

## Syntax

To declare a `CITEXT` column, use the type name directly in your `CREATE TABLE` statement:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
CREATE TABLE logins (
    name CITEXT PRIMARY KEY,
    email TEXT NOT NULL
);
```

## Size

As with `STRING`, `CITEXT` values should be kept below 64 KB for best performance. Because `CITEXT` values resort to a collation engine on every comparison, `CITEXT` columns and indexes consume marginally more CPU and memory than their `STRING` equivalents.

## Example

Create and populate a table:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
CREATE TABLE logins (
  username CITEXT,
  email STRING
);
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
INSERT INTO logins VALUES
('Roach', 'Roach@example.com'),
('lincoln', 'lincoln@example.com');
```

Because `CITEXT` comparisons are case-insensitive, an equality predicate matches regardless of letter case:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SELECT * FROM logins WHERE username = 'roach';
```

```
  username |       email
-----------+--------------------
  Roach    | Roach@example.com
(1 row)
```

An ordering comparison is also case-insensitive with `CITEXT`:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SELECT username FROM logins WHERE username < 'Xavi';
```

```
  username
------------
  Roach
  lincoln
(2 rows)
```

For case-sensitive comparisons on `CITEXT` values, cast to `STRING` explicitly. In the default Unicode ordering, an uppercase value is considered less than the lowercase value in the table:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SELECT username FROM logins WHERE username::STRING < 'Xavi';
```

```
  username
------------
  Roach
(1 row)
```

## Known limitations

* `CITEXT` types are not currently compatible with the `LIKE` and `ILIKE` operators.

## See also

* <InternalLink path="data-types">Data Types</InternalLink>
* <InternalLink path="string">`STRING`</InternalLink>
* <InternalLink path="collate">`COLLATE`</InternalLink>
