Re: GENERATE AS

Поиск
Список
Период
Сортировка
От Ilya Kosmodemiansky
Тема Re: GENERATE AS
Дата
Msg-id D598E4B1-1B40-4B55-89A2-9296CDD2985D@dataegret.com
обсуждение исходный текст
Ответ на GENERATE AS  ("Wetmore, Matthew (CTR)" <Matthew.Wetmore@express-scripts.com>)
Ответы Re: GENERATE AS  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-admin
Hi Matthew,

On 22. Jun 2023, at 22:00, Wetmore, Matthew (CTR) <Matthew.Wetmore@express-scripts.com> wrote:

4. ALTER TABLE auto_auth.matt

               ADD column matt_hour INT  GENERATED ALWAYS AS (date_part('hour', current_timestamp)::INT - date_part('hour', matt_time)::INT) stored       

              

               ERROR:  generation expression is not immutable

SQL state: 42P17


You can use only immutable functions to generate columns. Timestamp with time zone as an argument makes function not immutable because timezone could be set locally and  results could differ depending on timezone 

best regards,
Ilya

 

 

@font-face { font-family: "Cambria Math"; } @font-face { font-family: Calibri; } p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; } a:link, span.MsoHyperlink { color: rgb(5, 99, 193); text-decoration: underline; } a:visited, span.MsoHyperlinkFollowed { color: rgb(149, 79, 114); text-decoration: underline; } span.EmailStyle17 { font-family: Calibri, sans-serif; color: windowtext; } .MsoChpDefault { font-family: Calibri, sans-serif; } @page WordSection1 { size: 8.5in 11in; margin: 1in; } div.WordSection1 { page: WordSection1; }

В списке pgsql-admin по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: GENERATE AS
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: GENERATE AS