И ещё ошибка с from psycopg2 import OperationalError, он просто не находит OperationalError
>>> from psycopg2 import OperationalError
>>> OperationalError
<class 'psycopg2.OperationalError'>
>>> psycopg2.__version__
'2.8.6 (dt dec pq3 ext lo64)'
The error 'FATAL: password authentication failed for user "postgres"
Как этот пароль посмотреть или новый создать?
ALTER ROLE postgres WITH PASSWORD '123';
или в psql \password
class vk_api.longpoll.VkLongPoll(vk, wait=25, mode=234, preload_messages=False, group_id=None)
wait — the waiting period (as most proxy servers terminate the connection after 30 seconds, we recommend indicating wait = 25). Maximum: 90.
lp = VkLongPoll(vk_session, group_id=123456789)
postgres=# select '{"email": "a@example.com", "telegram_token": "", "telegram_user_id":""}'::jsonb - 'email';
?column?
------------------------------------------------
{"telegram_token": "", "telegram_user_id": ""}
(1 row)
UPDATE group_settings
SET group_recepients = jsonb_build_object('email', subquery.email, 'telegram_token', '', 'telegram_user_id', '')
FROM (SELECT id, email from users) AS subquery WHERE group_settings.user_id = subquery.id;
IF OLD.bilet_number IN (SELECT bilet_number FROM all_lends)
хотите удалить этого абонента (и только его), то нужно было делать обычный не INSTEAD) триггер и вместо DELETE оператора в конце сделать RETURN OLD
. CREATE USER user_name PASSWORD (SELECT random_string((SELECT random_int_between(5,15))));
Non-optimizable SQL commands (also called utility commands) are not capable of accepting query parameters. So automatic substitution of PL/pgSQL variables does not work in such commands. To include non-constant text in a utility command executed from PL/pgSQL, you must build the utility command as a string and then EXECUTE it, as discussed in Section 43.5.4.
SELECT random_string(SELECT random_int_between(5,15)) INTO pass;
EXECUTE format('CREATE USER %I PASSWORD %L', user_name, pass);
EXECUTE format('GRANT %I TO %I', role_name, user_name);
Changed in version 2.9: the table and fields names are now quoted. If you need to specify a schema-qualified table please use copy_expert().
// предварительно распарсить json:
// $json = json_decode($response, true);
file_put_contents("file.wav", $json["data"]);
И так получилось что Маше возвращается ID Саши, то есть ID=2;
select * from (
select DISTINCT (regexp_split_to_array(commend, E'\\s+'))[:3] as words from orders
) t
order by words[2]
select client_id, st, en, avg(bal)
from (
select *,
max(day) filter (where l = 1) over (partition by client_id order by day) st,
min(day) filter (where r = 1) over (partition by client_id order by day range between current row and unbounded following) en
from (
select *,
case when (lag(bal) over w) > 0 then 0 else 1 end as l,
case when (lead(bal) over w) > 0 then 0 else 1 end as r
from balance
window w as (partition by client_id order by day)
) t
where bal > 0
) t1 group by client_id, st, en
order by 1, 2
возвращает только верхнее исключение, возникшее внутри самой stack_capture(). Отчего так происходит и можно ли получить весь стек?
my_tb = stack_capture(raising_func)
t = my_tb
while t:
print(t.tb_frame, t.tb_lineno, t.tb_lasti)
t = t.tb_next