Hello.
I'm trying to understand, what is maximum length of varchar2 string? The readme states:
>> » Please note that unlike Oracle, orafce’s VARCHAR2 and NVARCHAR2 do not impose the 4000 bytes limit on the 'declared' size. In fact it is same as that of PostgreSQL varchar, which is about 10MB (although varchar can theoretically store values of size up to 1GB)
It's not quite clear to me what this means. PostgreSQL's plain varchar, if you do not specify (n), stores values up to 1GB. If you specify (n), then n must not be greater than 10*1024*1024, indeed.
I conveyed an experiment:
create table tstvarchar2(
id int primary key,
value varchar2(10485760)
);
insert into tstvarchar2 (id, value) values (1, generate_random_string(10485760));
And I got an error: row is too big: size ..., maximum size 8160.
I got the same error when I replaced varchar2(10*1024*1024) with just varchar2.
When I used plain PostgreSQL's varchar, I got no error either with varchar(10485760) nor with simple varchar.
I searched for the number 8160 in orafce's repo and found nothing. The only idea I have what it is - is that this is maximum tuple size in PostgreSQL (slightly less than one block). But shouldn't TOAST mechanism automatically fire when I try to insert larger values?
versions: PostgreSQL 14.2 on debian, orafce 3.22.0 from debian repos.
So, the questions are:
* where does this 8160 come from? Oracle's limit is either 4000 or 32k, depending on settings...
* is this a bug in orafce, in postgres, or is this intended behaviour? If so, where is it documented?
Best regards,