This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checkpointComplete %{date("yyyy-MM-dd HH:mm:ss z"):date}\:\:@\:\[%{integer:group_id}\]\:%{notSpace:severity}\:\s+checkpoint complete: wrote %{integer:buffers.wrote} buffers \(%{number:buffers.percent}\%\); %{integer:walfile.added} WAL file\(s\) added, %{integer:walfile.removed} removed, %{integer:walfile.recycled} recycled; write=%{number:time.write} s, sync=%{number:time.sync} s, total=%{number:time.total}\ s; sync files=%{integer:sync.files}, longest=%{number:sync.longest} s,\s+average=%{number:sync.average} s;\s+distance=%{integer:distance}\s+kB,\s+estimate=%{integer:estimate}\s+kB;\slsn=%{notSpace:lsn},\sredo lsn=%{notSpace:redo_lsn} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- first create a schema to store your new table | |
CREATE SCHEMA dba; | |
-- create the table | |
CREATE TABLE dba.log_stat (LIKE pg_stat_user_tables); | |
--- add a column to timestamp the figures | |
ALTER TABLE dba.log_stat ADD COLUMN eventtime timestamp with time zone default now(); | |
--- last action insert the stats in the table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Want to file the holes in a column previously defined with a serial | |
-- Useful only with small tables with less than 10k rows, over the operation | |
-- max() and the join will cost too much | |
-- | |
CREATE OR REPLACE FUNCTION nextid() | |
RETURNS integer | |
LANGUAGE plpgsql | |
AS $$ | |
DECLARE | |
new_id integer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION {{table_name}}_historization_update_trg() | |
RETURNS trigger LANGUAGE plpgsql AS $$ | |
BEGIN | |
-- we increment the version number | |
NEW.version = OLD.version + 1; | |
INSERT INTO {{schema}}.{{table_name}}_log (id, version, data) | |
VALUES (NEW.id, NEW.version, to_json(NEW)); | |
RETURN NEW; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
osmosis --read-pbf france-latest.osm.pbf \ | |
--node-key-value keyValueList="amenity.recycling" \ | |
--write-xml france-latest.osm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[local]:5412 rodo@rodo=# SELECT get_random_date(), | |
get_random_date('3 week') as rand, | |
get_random_date('3 week', 'past') as past, | |
get_random_date('3 week', 'future') as future, | |
generate_series(1,7); | |
get_random_date | rand | past | future | generate_series | |
-----------------+------------+------------+------------+----------------- | |
2017-03-01 | 2021-02-27 | 2021-02-19 | 2021-03-04 | 1 | |
2007-03-25 | 2021-03-06 | 2021-02-15 | 2021-02-25 | 2 | |
2019-09-01 | 2021-02-21 | 2021-02-14 | 2021-03-02 | 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[local]:5412 rodo@rodo=# SELECT trunc(random()*100); | |
trunc | |
------- | |
84 | |
(1 row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[local]:5412 rodo@rodo=# SELECT get_random_date('1 week'), generate_series(1,5); | |
get_random_date | generate_series | |
-----------------+----------------- | |
2021-02-22 | 1 | |
2021-02-18 | 2 | |
2021-02-17 | 3 | |
2021-02-22 | 4 | |
2021-02-17 | 5 | |
(5 rows) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rmmod snd_seq_midi | |
rmmod snd_seq_midi_event | |
rmmod snd_soc_skl | |
rmmod snd_soc_core | |
rmmod snd_compress | |
rmmod snd_hda_intel | |
rmmod snd_hwdep | |
rmmod snd_seq | |
rmmod snd_hda_codec | |
rmmod snd_hda_ext_core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# our template database will be called template2 | |
# as user foobar | |
$ createdb template2 | |
$ psql -d template2 -c 'create table test (id integer)' | |
$ psql -d template2 -c '\d' # you see that the table is owned by foobar | |
# create a new db based on the template | |
$ createdb new -T template2 -O newuser | |
$ psql -d new -c 'REASSIGN OWNED BY foobar TO newuser' | |
$ psql -d new -c '\d' # the table test is owned by newuser | |
$ psql -l # show that the owner of template2 is now newuser |
NewerOlder