pg_sql | Unsorted

Telegram-канал pg_sql - PostgreSQL

2806

English speaking PostgreSQL public chat. This group is for discussions on PostgreSQL-related topics and strives to provide best-effort support as well.

Subscribe to a channel

PostgreSQL

Well, I reckon we've all once rebooted the wrong server, locked ourselves out of a live server with a wrong iptables rule etc.
But since I do databases full time, I kind of got *far* more careful. And I'm *so* glad that there are transactions 😇

Читать полностью…

PostgreSQL

s/production/developmestruction/

You essentially have four options now:
* restore to a new DB and write a client that syncs them
* try to restore in a single transaction (i.e., use --single-transaction and --clean in pg_restore) and hope that your clients can cope with it (and that you have a proper pg_dump, not just an SQL file...).
* if you only have a text/SQL file, sed, grep, vi and friends can help you restore the tables you f***ed up as new tables and then you might be able to re-fill your live tables with what you destroyed...
* schedule a downtime and do a proper restore

At the end of the day, anything that has been chanced in the DB since you dumped will be lost, unless you manage to get option #1 or #3 working, so...

Oh, and: Once you have this situation sorted, you should set up a "playground" copy of your DB that you can actually play around with. And familiarize yourself with things like PITR, RTO/RPO/RCO, real backups etc. pp.

Читать полностью…

PostgreSQL

Yeah, PostgreSQL made me learn NULL casting...

NULL::integer
NULL::text

Because Nulls are not typed, and without those, I had so many complaints. (I cannot find the function you are calling, despite you typing the name perfectly... With the parameters passed)...
Ughh, after awhile, you get used to it.

Читать полностью…

PostgreSQL

Yh i made a back up earlier
And now restoring it
And I am not sure if I can do: create empty db and restore to that
Why because it is a production thing

Читать полностью…

PostgreSQL

You should, your client tried to connect unencrypted...

Читать полностью…

PostgreSQL

I tried with hostssl also, but getting same result

Читать полностью…

PostgreSQL

Hello,
I'm getting this error while connecting from test to prod. i made all necessary entries in hba file. But application did not face this issue. Any one have idea on this?

psql: error: connection to server on
"10.200.00.01", port 5432 failed: FATAL: no pg_hba.conf entry for host "10.34.00.01", user "dba", database "postgres", no encryption

Читать полностью…

PostgreSQL

Add a constraint and check that the length of the trimmed string is > 0

Читать полностью…

PostgreSQL

That insert is not passimg NULL it is passing ‘’, which is not a null value

Читать полностью…

PostgreSQL

Again, you're not passing NULL, you're passing an empty string.

Читать полностью…

PostgreSQL

It would be easier if you share a test case, I mean, show us the creation of the table and your insert and select from that table.

Читать полностью…

PostgreSQL

I didn’t get what’s the issue: Postgres is wrongly converting your empty string in NULL value so it doesn’t allow u to add the entry in the table?

Читать полностью…

PostgreSQL

Even chatgpt failed to answer this

Читать полностью…

PostgreSQL

I mean, what's in the row after the insert??

Читать полностью…

PostgreSQL

Given not null constraint

Читать полностью…

PostgreSQL

I have a New Client... ncdb
And I SOLELY operate in nctest
When I connect with psql, the prompts get different colors.

Читать полностью…

PostgreSQL

https://momjian.us/main/writings/pgsql/nulls.pdf
helped me a lot to wrap my head around it ;-)

Читать полностью…

PostgreSQL

Hello Guys,

can I know which method I can use in this case.

I've timescaledb and a hypertable in my source. I just needed to replicate and copy all the data in this hypertable to a new exactly same structure table in the same server or the same database, and also any ongoing changes will be replicated as well.

Thanks in advance

Читать полностью…

PostgreSQL

That sounds like you're trying to restore, not back up... Try renaming your broken DB and restore to an empty new one.

Читать полностью…

PostgreSQL

Absolutely stuck with a restoration:
So I backed up my db
And made lots of changes
But missed one dependency case
Now I have to restore the backup and redo all of the changes within hrs
But not able to back it up
There are so many errors ( must be a member, table exists, column exists etc )


-ps backend developers given with DE work, working on pgadmin
Just startedup with data handling so any help is good help

Читать полностью…

PostgreSQL

Did you (hopefully) put a hostssl entry into pg_hba.conf? Or is there another line without the "no encryption" above it as well?

Читать полностью…

PostgreSQL

This way you also exclude empty spaces, a single \n, \t characters and so on

Читать полностью…

PostgreSQL

You can create a check constraint for values <> ‘’

Читать полностью…

PostgreSQL

can you plz tell how to deal with '' constraint if someone will pass '' this then I dot want to allow him/her?

Читать полностью…

PostgreSQL

CREATE TABLE Orders (
order_id SERIAL PRIMARY KEY, -- Auto-incrementing primary key
order_date TIMESTAMP DEFAULT NOW(), -- Date and time of the order
total_amount NUMERIC(10, 2) NOT NULL, -- Total amount for the order
txt TEXT NOT NULL -- Text field, cannot be NULL
); I created table like this now I am trying to add record
INSERT INTO Orders ( total_amount, txt) VALUES (250.75, '' ); even though I pass null value still allowing; however txt field has not null constraint

Читать полностью…

PostgreSQL

I'm pretty sure OP has an Oracle background...

An empty string ('') is not NULL, even if Oracle treats it that way. No other proper DBMS or the SQL standard does so, btw.

Читать полностью…

PostgreSQL

Can anyone plz answer?

Читать полностью…

PostgreSQL

Yes i checked in table entry itz null . I given value like ‘m

Читать полностью…

PostgreSQL

And you double checked that you're sending NULL, not 'NULL' or '' or 0?

Читать полностью…

PostgreSQL

Can anyone plz tell how to solve this?

Читать полностью…
Subscribe to a channel