Lists: | pgsql-general |
---|
From: | akp geek <akpgeek(at)gmail(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | ERROR: index row requires 9984 bytes, maximum size is 8191 |
Date: | 2011-01-19 22:07:46 |
Message-ID: | AANLkTi==doHqUw=1p8BAMpGY=ffJLhwkZ+Uwus3BAo2t@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Hi all -
I have added a column to a table is which of datatype text. I am
trying to create an index
CREATE OR REPLACE FUNCTION reverse(varchar) RETURNS varchar AS $$
$reversed = reverse $_[0];
return $reversed;
$$ LANGUAGE plperlu IMMUTABLE;
CREATE INDEX rev_email ON users( (reverse(email) ) varchar_pattern_ops );
I am getting the following error ERROR: index row requires 9984
bytes, maximum size is 8191
my logs are not showing any thing else , but the error. Can you please help?
Regards
From: | Bill Moran <wmoran(at)potentialtech(dot)com> |
---|---|
To: | akp geek <akpgeek(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: ERROR: index row requires 9984 bytes, maximum size is 8191 |
Date: | 2011-01-19 22:54:52 |
Message-ID: | 20110119175452.59e2149d.wmoran@potentialtech.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
In response to akp geek <akpgeek(at)gmail(dot)com>:
> Hi all -
>
> I have added a column to a table is which of datatype text. I am
> trying to create an index
>
> CREATE OR REPLACE FUNCTION reverse(varchar) RETURNS varchar AS $$
> $reversed = reverse $_[0];
> return $reversed;
> $$ LANGUAGE plperlu IMMUTABLE;
>
>
> CREATE INDEX rev_email ON users( (reverse(email) ) varchar_pattern_ops );
>
>
> I am getting the following error ERROR: index row requires 9984
> bytes, maximum size is 8191
>
>
> my logs are not showing any thing else , but the error. Can you please help?
Indexes have a maximum size. I don't think there's much overhead on
a varchar index, so it would seem that your email column has at least
one value that is about 9984 bytes long. That doesn't seem like a
valid email address to me.
Could also be an error with your function, although it looks simple
enough.
What is the output of
SELECT MAX(octet_length(email)) FROM users;
and
SELECT MAX(octet_length(reverse(email))) FROM users;
--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/