Add a test case related to the error "cannot fetch toast data without an active snapshot"
От | Nitin Jadhav |
---|---|
Тема | Add a test case related to the error "cannot fetch toast data without an active snapshot" |
Дата | |
Msg-id | CAMm1aWZ6uT72t8fZAK8mLiH0pDRuc_s9F=NXVbE8tO5oWRKfxA@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Add a test case related to the error "cannot fetch toast data without an active snapshot"
|
Список | pgsql-hackers |
Hi, I was going through the comments [1] mentioned in init_toast_snapshot() and based on the comments understood that the error "cannot fetch toast data without an active snapshot" will occur if a procedure fetches a toasted value into a local variable, commits, and then tries to detoast the value. I would like to know the sample query which causes such behaviour. I checked the test cases. Looks like such a case is not present in the regression suit. It is better to add one. [1]: /* * GetOldestSnapshot returns NULL if the session has no active snapshots. * We can get that if, for example, a procedure fetches a toasted value * into a local variable, commits, and then tries to detoast the value. * Such coding is unsafe, because once we commit there is nothing to * prevent the toast data from being deleted. Detoasting *must* happen in * the same transaction that originally fetched the toast pointer. Hence, * rather than trying to band-aid over the problem, throw an error. (This * is not very much protection, because in many scenarios the procedure * would have already created a new transaction snapshot, preventing us * from detecting the problem. But it's better than nothing, and for sure * we shouldn't expend code on masking the problem more.) */ Thanks & Regards, Nitin Jadhav
В списке pgsql-hackers по дате отправления: