Subject | Re: Error on restore db "sort record size of 65640 bytes is too big" |
---|---|
Author | Rick Roen |
Post date | 2006-03-06T22:37:43Z |
Thanks Helen,
It must have failed during a check constraint. I have another UDF
that is like this:
DECLARE EXTERNAL FUNCTION F_LENGTH
CSTRING(32767)
RETURNS INTEGER BY VALUE
ENTRY_POINT 'fbLength' MODULE_NAME 'Primavera_UDF';
I used it in a check constraint to make sure a social security
number was valid.
I went to this CSTRING value becuase of odd results I got with lower
values. See message 72539 for a fuller explanation, but over 256 or
so, the UDF failed. When I set the CSTRING to its max value it was
ok.
I never, ever (don't I know better than to say that?) have HTML or
VarChars that will be this big, however I do have over 256 where it
failed before. Even with a CSTRING value of 4096 I failed on char
256.
And no, I didn't backup to a new name, so I lost all the information
I had been working on since this morning. Live an learn! Luckily it
took me all morning to figure something out that I can recreate
pretty easily.
I did delete the two UDF's, backed up, changed the UDF's back to
CString(2048), and restored sucessfully, so that was most likely the
problem. I just need to work around the CSTRING problem now. Maybe
I will just rewrite the UDF into SP's since I think I can do them
both in SQL by stepping through the string and either counting or
escaping a character.
Please let me know if you have any clue about the CSTRING size.
Rick
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...>
wrote:
It must have failed during a check constraint. I have another UDF
that is like this:
DECLARE EXTERNAL FUNCTION F_LENGTH
CSTRING(32767)
RETURNS INTEGER BY VALUE
ENTRY_POINT 'fbLength' MODULE_NAME 'Primavera_UDF';
I used it in a check constraint to make sure a social security
number was valid.
I went to this CSTRING value becuase of odd results I got with lower
values. See message 72539 for a fuller explanation, but over 256 or
so, the UDF failed. When I set the CSTRING to its max value it was
ok.
I never, ever (don't I know better than to say that?) have HTML or
VarChars that will be this big, however I do have over 256 where it
failed before. Even with a CSTRING value of 4096 I failed on char
256.
And no, I didn't backup to a new name, so I lost all the information
I had been working on since this morning. Live an learn! Luckily it
took me all morning to figure something out that I can recreate
pretty easily.
I did delete the two UDF's, backed up, changed the UDF's back to
CString(2048), and restored sucessfully, so that was most likely the
problem. I just need to work around the CSTRING problem now. Maybe
I will just rewrite the UDF into SP's since I think I can do them
both in SQL by stepping through the string and either counting or
escaping a character.
Please let me know if you have any clue about the CSTRING size.
Rick
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...>
wrote:
>size
> At 08:01 AM 7/03/2006, you wrote:
> >I just backed up and restored a 1.5 DB.
> >
> >On the restore, using DBWorkbench, I get an error "sort record
> >of 65640 bytes is too big".statement
>
> AFAIK, this error occurs when the size of an output record (which
> might be in an intermediate set) in a GROUP BY or ORDER BY
> is too wide.If
>
>
> >This happens at the end of recreating some FK's, possibly on the
> >first procedure to be recreated.
>
> Procedures aren't recreated during a restore.
>
>
> >I saw a post in this ng, however it was related to a very, very
> >large select which involved 30 + tables.
>
> You might be referring to the size limit of a query plan (48 Kb).
> so, that's a different problem to yours. Your problem relates toa
> record size, which is a max. of 64Kb, less a few bytes.like:
>
> Search your metadata for a constraint - most likely a check
> constraint - that has an ordered or grouped subquery expression.
>
>
> >The only thing I can think of is a UDF that I recently changed and
> >use in several procedures. The udf is for escaping HTML code
> >produced within a procedure, and is declared like this:
> >
> >DECLARE EXTERNAL FUNCTION F_ENCODE_HTML
> > CSTRING(32767)
> > RETURNS CSTRING(32767) FREE_IT
> > ENTRY_POINT 'Str_EncodeHTML' MODULE_NAME 'Primavera_UDF';
> >
> >I might call this function several times in a select statement
> >Select F_Encode_HTML( Name ), F_Encode_HTML( City ) ... from<table>
>ordered
> That could do it. Your restore is falling over during constraint
> building, so it would likely be a call that's located in an
> or grouped subquery expression in a check constraint.if
>
> FWIW, that UDF declaration is going to blow up whenever you use it
> you are passing those strings to or from varchars. You shouldreduce
> those cstring size declarations to 32765, the byte-length limit ofresult
> varchar. But there's a worse flaw there. The input string size is
> way too large, since passing a full size string into it and then
> adding escape characters is going to cause an overflow in the
> string, as sure as night follows day.it
>
> Next time you write a UDF, it would be rather a good idea to test
> using extremes for your arguments before you plug it into adatabase
> you care about.Kill
>
> >Could this be the problem
>
> Yes.
>
> > and is there any way to restore from this backup?
>
> Probably not. I hope you weren't trying to restore it using the
> -r[eplace_database] switch. That's No. 1 in the Top Six Ways to
> a Database.further.
>
> If you still have an intact database, it would be good to put it
> offline and make a filecopy of it to put on ice before you proceed
>them
> Inspect your metadata closely for these pitfalls and eliminate
> before trying another backup.the use the
>
> And, when you restore it, restore to a different filename using
> -c[reate_database] option.
>
> ./heLen
>