pg_cron icon indicating copy to clipboard operation
pg_cron copied to clipboard

in table cron.job please change type column jobname to varchar(127)

Open sgrinko opened this issue 3 years ago • 2 comments

In the cron.job table, the jobname field has type name. This is a systemic type of data that is not recommended to use. From the documentation:

The name type exists only for the storage of identifiers in the internal system catalogs and is not intended for use by the general user. Its length is currently defined as 64 bytes (63 usable characters plus terminator) but should be referenced using the constant NAMEDATALEN in C source code. The length is set at compile time (and is therefore adjustable for special uses); the default maximum length might change in a future release.

I found that if you write symbols with national symbols in this type of data, then the length of the preserved text decreases.

I ask you to change this type of data to the type varchar(127) or even varchar(256). I use a lot of text in the name Job.

sgrinko avatar Aug 07 '22 16:08 sgrinko

Fair point. Name was chosen for similar reasons as postgres: it has a fixed size in memory, which simplifies memory management in the long-running daemon. That said, this is similarly contentious in postgres.

marcocitus avatar Aug 10 '22 07:08 marcocitus

But other fields in the tables have the type of text and do not cause the described problems? Very inconvenient for jobname field has type name. It is especially bad that the value is covered, and does not give an error when inserting. It is also very unexpected to see that the maximum length of the field is 64 signs, but when inserting it suddenly discover that only 40 signs were preserved.

sgrinko avatar Aug 10 '22 11:08 sgrinko

Hi, I encounter this problem by surprise at my postgres environments: I have reached the maximum lenght for jobname (63) and it is very problematic now because can be repeated any and fail to select by jobname. When could it be resolved?

cesarjorgemartinez avatar Oct 07 '22 11:10 cesarjorgemartinez

Good afternoon.

I support the proposal to change the type of the jobname field. I also encountered the fact that the field size is very small and it was not possible to fit all the necessary information into 64 characters, I had to revise the names of a large set of typical jobs.

It was all the more unpleasant that when inserting into the job name field, there were no errors, and in the meantime only part of the text was saved.

xinferum avatar Oct 10 '22 15:10 xinferum