datagrip Cannot apply changes This table is read only. Cell editor changes cannot be applied - postgresql

So simply the problem occurs when I want to edit selected rows and then apply it. I'm sure it worked some time ago. Tried redownload postgres driver in preferences(yeah, I use postgres) Anyone faced same issue? Anyone succeed?
PS. Running on 142.4861.1.
I found read only checkbox in connection preferences, it was not set, toggling didn't help, upgrading, reseting also didn't help.

In my case in version 2020.1 of DataGrip (SQL was run from the opened file, on unique table, so that select just worked as expected, but when I was trying to edit - error appeared: unresolved table reference): specifying schemes in request helped. So that SELECT * FROM users; was changed to SELECT * FROM schemadb.users; and that helped. Probably there is a bug. I've tried all the methods mentioned above.

Try synchronize database connection. It helped me in mysql connection.

What actually helped was toggling Auto-commit checkbox in console, after that everything runs flawlessly.

The only thing that actually worked for me, after trying everything above multiple times, was deleting each DB connection and remaking a new one from scratch.

This can be due to default settings, make it sure your your transaction Mode settings are as below

I had the same issue with datagrop 2020.2. I have followed all the method but for me, just delete the connection and create new connection (never trying to duplicate) just manual. It is works!

Set and clear Read-only in Data Source Properties helps me.

What worked for me was removing a field alias - going from this:
SELECT
l.MSKU Item_SKU,
l.Supplier,
l.ASIN,
l.title,
l.Buy_Price
FROM listings l
WHERE l.Buy_Price IS NULL
ORDER BY l.Supplier, l.listingID desc;
to this:
SELECT
l.MSKU,
l.Supplier,
l.ASIN,
l.title,
l.Buy_Price
FROM listings l
WHERE l.Buy_Price IS NULL
ORDER BY l.Supplier, l.listingID desc;
is all it took for me to be able to edit the results of the query

If your query is using field alias (renaming column instead of using actual column name) , then Datagrip set data results as read only.
Solution:
Rewrite query using field names as in the table and rerun query. Then you will be able to edit the rows.
Example
Rewrite this:
select id,interest_recalcualated_on, interest_recalculation_enabled alias from m_loan;
..to this:
select id,interest_recalcualated_on, interest_recalculation_enabled from m_loan;

Nothing worked. I had to update DataGrip from 2017.2 to 2018.3
I had to open the project by navigating to: /home/user/.DataGrip2017.2/config/projects/my_project/
All my scripts for this project as I did not want to import the config from the old version of Datagrip. So I'll probably need to downgrade, get the scripts and upgrade again.

I struck the same issue, not Postgres but MySql, PhpStorm 2019.1 when I had two schema available on the same db connection and my query: select * from users where full_name like '%handy%'; resulted in a result table that couldn't be edited even though the console reported it was querying the stage schema. A more specific query: select * from stage.users where full_name like '%handy%'; using the exact table name led to a results table that could be inline edited.

The only way I was able to get around this issue was to remove the database connection details for the given connection and recreate them from scratch. While this was happening to me on this specific connection, editing was working fine on other connections, which suggests the problem might be related to specific parameters around the connection in question.

For me, when I changed back my Select query to * (wild char to select all the columns), from specific columns, the edit and save started to working again. This is strange! May be worth reporting a bug to intellij. I'm using DataGrip 2020.1 on macOs Catalina 10.15.3

I thought I had the same problem but just realized I needed to submit changes (with a button or command + enter) for them to be applied.
This answer is 4 years late though. Maybe the bug was already fixed haha, but this may help someone else.

The problem for me was the obvious (well obvious after identifying it) - using a MySQL keyword as a field name (yes I know its not a good idea but thats how it is sometimes). So this caused the error
select id,name,value from mytable;
The correct way to write this of course is using backticks so:
select id,name,`value` from mytable;
and this solved it for me.

seems like DataGrip doesn't allow to change data in the ui table if you select specific columns with joins.
so if you select table1.column1, table2.column2 from <table1> inner join <table2> and try to change the value in column1, you will receive This table is read only warning
only if you do select * from <table>, you can edit the cell values

try this
In the IDE settings (Ctrl+Alt+S), go to Database | General.
Select the Open results in new tab checkbox and click OK.
Re-run your query, and you'll be able to edit and commit the changes in the new tabs.

Related

DBeaver - Column "columns name' is read-only: No corresponding table column

I am using DBeaver on Mac and suddenly can't edit/udpate anything on results cell, I get this message: Column "columns name' is read-only: No corresponding table column. However, when I use UPDATE command it works just fine.
The challenge is that I have multiple updates to make and it is very convenient to do it ib the results cells.
Other users still can do it and I am suspecting this is something related to my DBeaver client
Any thoughts? Thank you!
Same issue here, solved after ommiting rowid as column in then select clause. It appears to be a conflict betwween named an * as column selector in 22.3.3 version. Try to use only * or name explicitly selected columns.
I have faced the same issue, when added a column from script and tried to update data on table from UI. it can solved by disconnecting and connecting to database as DBeaver currently don't refresh the DDLs.

Can't see entire SQL table in terminal

I am learning postgreSQL and created a table using mock data (from a random data generator). When I run the SELECT * FROM {table} command, I can only see the top part of the table. It seems to cut off at a certain point and then restart from the beginning. Is this a terminal setting or is there something else I am doing wrong?
Thank you for your help!
I actually just got it figured out, for some reason my default was changed to bash instead of zsh. Now it is working where I can scroll and see the entire table. Thank you all!

INTERBASE - INDEX ISSUE

Good day,
I run many databases under interbase XE7 and 2017 now.
Lately, I got a strange behavior on one of the db:
A table with a primary key was found hosting many rows with similar values, like image below.
We can see that SCRIPTTYPE is a primary key column and it contains many times MATRIX, no space or strange characters ( I checked).
I was able to backup / restore without issues.
I am puzzled by this and I am wondering if anybody did encountered something similar?
And how it was done?
Thanks.
enter image description here
Run this query to be sure:
select SCRIPTTYPE, count(*)
from yourtable
group by SCRIPTTYPE
order by 2 desc
If you get a count>1, then I'd argue it's simple a bug and you should contact support. For them to assist you they'll almost certainly need your database, so you should be prepared to provide that. Based on your description, you should be able to drop all tables except the one, and drop all fields except your key, then backup and restore to get the simplest test case.

trying to delete data from table

in mysql workbench im trying to execute
delete from basic_info where rollno>3;
this query but im getting this message
Error Code: 1175. You are using safe update mode and you tried to
update a table without a WHERE that uses a KEY column To disable safe
mode, toggle the option in Preferences -> SQL Editor and reconnect.
You can try using below commands.
SET SQL_SAFE_UPDATES=0;
delete from basic_info where rollno>3;
SET SQL_SAFE_UPDATES=1;
Create an INDEX with rollno column, good for a long term not only this query
You didn't say which MySQL Workbench you are using, but make sure you always use the latest one to get all latest bugfixes.
Since you obvioulsy have a where clause in your query it looks like it is not recognized (which would be a bug). Hence my advice to use the latest version.
In any case you can disable the safety check in the preferences of MySQL Workbench.

Microsoft Access ADP UPDATE Query does NOT update

I have a (very simple and standard) UPDATE statement which works fine either directly in Query Analyser, or executed as a stored procedure in Query Analyser.
UPDATE A
SET
A.field1 = B.col1
, A.field2 = B.col2
FROM
tblA AS A INNER JOIN tblB AS B
ON A.pk1 = B.pk1 AND A.pk2 = B.pk2
Problem is when i execute the same stored proc via microsoft ADP (by double-clicking on the sproc name or using the Run option), it says "query ran successfully but did not return records" AND does NOT update the records when i inspect the tables directly.
Before anyone even says "syntax of MS-Access is different than SQLServer T-SQL", remember that with ADP everything happens on the server and one is actually passing thru to T-SQL.
Any bright ideas from any ADP gurus out there?
Gotcha. Responding to my own question for the benefit of anyone else.
Tools / Options / Advanced / Client-Server Settings / Default max records is set at 10,000 (presumably this is the default). Change this to 0 for unlimited.
My table had 100,000+ rows and whatever set of 10,000 it was updating was difficult to find ( among a sea of 90,000+ un-updated rows ). Hence the update did not work fully as expected.
Try and see whether the query gets executed on the SQL Server using SQL profiler.
Also, I think you might need to close the linked table & re-open it to see the updated records.
Does that work?
Run the query with SQL PRofiler running. Before you start the trace add in all the error events. This will give you any errors that the SQL Server is generating that the Access ADP might not be showing correctly (or at all).
Feel free to post them here.
Just as a reference, here's a paper I wrote on Update Queries that discusses some of the issues associated with when the fail.
http://www.fmsinc.com/microsoftaccess/query/snytax/update-query.html
I seem to remember that I always got the "didn't return any rows" message and had to simply turn off the messaging. It's because it isn't returning any rows!
as for the other - sometimes there's a primary key issue. Does the table being updated have a primary key in SQLServer? If so, check the view of the table in Access - sometimes that link doesn't come through. It's been a while, so I could be wrong, but I think you may need to look at the design view of the table while in access and add the primary key there.
EDIT: Additional thought:
in your debugging, try throwing in print statements to see what the values of your inputs are. Is it actually picking up the data from the table as you expect when you execute from access?