Remove ability in Tinymce to insert a table into a table - plugins

Using the standard Tinymce Table plugin it is possible to insert a table into a cell of an existing table. I want to prevent this, preferably by disabling the Table menu option when the cursor is currently within a table.

Related

Why datawindow query does not refresh column specifications?

The Query behind datawindow is Select * from MyTable. I changed the table and added another column. When i retrieve the datawindow in design mode, it does not show me the new column i added in MyTable
I assume that Select * from MyTable will not require editing datawindow in design mode and every change in database table will update the datawindow design as well.
How do i get all the columns in column specifications without changing datawindow in design mode to manually add the column in detail area of the datawindow?
PowerBuilder 12.5 /
MSSQL Server 2008
If you want to do this, you can use the create method of your datawindow control:
String new_sql, new_syntax, errorsyntaxfromSQL, errorcreate
new_sql = 'SELECT * from Mytable'
new_syntax = SQLCA.SyntaxFromSQL(new_sql, 'Style(Type=Form)', error_syntaxfromSQL)
// Generate new DataWindow
dw_new.Create(new_syntax, error_create)
It is up to you to test the possible errors.
I assume that Select * from MyTable will not require editing datawindow in design mode and every change in database table will update the datawindow design as well.
This is not a valid assumption. If you change the underlying table columns either by adding, removing, or datatypes, you have to bring any datawindow objects which reference that table (by reference I mean you want to use the new column or had used an old column or one with the changed datatype) back into the editor to have them reflected in that dwo.
Another option is to edit the source of the datawindow object but this would only be for trivial updates (like you expanded a varchar field from 10 to 20).

How do I reload a table without deleting existing views?

I have a dataset that spans across many tables by date.
table_name_YYYY_MM_DD
There are many VIEWS created across these date range tables. However whenever I need to reload a table, I have to delete all these views to remove dependency constraints
DROP TABLE IF EXISTS table_name_YYYY_MM_DD cascade;
Is there a way to reload the table, as part of a transaction, to where the VIEWS don't need to be deleted. Eg create a new table, and swap their names, so that the transaction would guarantee the views don't need to be deleted.
Don't drop the table. Instead, truncate it:
truncate table table_name_YYYY_MM_DD
This removes all rows (quickly), but the table remains. So other dependencies are not affected.
Afterwards, you need to insert the data back into the table, rather than recreating the table.

Create a new table with existing style from layer_styles table in postgres

Is there any way to create a postgis table with existing style from layer_styles table? Say for example i have so many styles stored in layer_styles table. I need to assign one of the style from layer_styles table to the new table which i am going to create. Can that be done using postgresql during table creation using sql command?
You need to identify the layer IDs of interest (or name, or any column you want) and to create the new table using this data+structure. However using the style in this secondary table may not be that easy
create table public.layer_styles_2 as
(select * from public.layer_styles where id in (2,3));

How to insert a row in postgreSQL pgAdmin?

I am new to postgreSQL. Is there any way to insert row in postgreSQL pgAdmin without using SQL Editor (SQL query)?
The accepted answer is related to PgAdmin 3 which is outdated and not supported.
For PgAdmin 4 and above, the application is running in the browser.
After you create your table, you have to make sure that your table has a primary key otherwise you couldn't edit the data as mentioned in the official documentation.
To modify the content of a table, each row in the table must be
uniquely identifiable. If the table definition does not include an OID
or a primary key, the displayed data is read only. Note that views
cannot be edited; updatable views (using rules) are not supported.
1- Add primary key
Expand your table properties by clicking on it in the pgAdmin4 legend. Right-click on 'Constraints', select 'Create' --> 'Primary Key'to define a primary key column.
2- View the data in excel like format
Browser view, right-click on your table --> select View/Edit Data --> All Rows
3- Add new row / Edit data
On the Data Output tab at the bottom of the table below the last row, there will be an empty row where you can enter new data in an excel-like manner. If you want to make updates you can also double click on any cell and change its value.
4- Save the changes
Click on the 'Save' button on the menu bar near the top of the data window.
I think some answers don't provide an answer to the original question, some of them insert records but with SQL statements and the OP clearly said WITHOUT, so I post the right answer: (Step by Step)
Alternatively you can use the query tool:
INSERT INTO public.table01(
name, age)
VALUES (?, ?);
use the lightning icon to execute.
You can do that without the SQL editor, but it's better to do this by queries.
Although, in pgAdmin, there is an option which you can click to have an excel-like window where you can add and update data in a table without using SQL language. Please select a table which you want to add a row first and click on the next icon here below.
Editing table data without primary key is forbidden
If your tables don't have a primary key or OIDs, you can view the data only.
Inserting new rows and changing existing rows isn't possible for the Edit Data tool without primary key.
Use INSERT:
INSERT INTO tablename (field1, field2) values ('value1', 2);
on pgAdmin 4, right-click on the table and use the item like below. You can also use that script in the background.
Finally, to watch the inserted data do like below. You can also use that script in the background.
All the above are correct answers. I just want to add that : When u create a table, make sure u have atleast one column as PRIMARY_KEY. Then, just follow the GUI : View/Edit data. U can add row as the last row of the table
As an update, the icon for the save button is different in pgAdmin 4.
This is how the menu should look after right-clicking on the table you want to insert into and hovering over "View/Edit Data".
After adding rows, either press F6 (on Ubuntu) or click the icon that looks like a stack of discs (database icon) with a lock on it.
Zoomed in:
Wide View:

PostgreSQL: Shadow Table

I am using Web2Py smart grid to show the content on the Web.
Since in the database there are some duplicated entries and I would like to hide it some the web. Which I believe there is no way to configure the smart grid. I would need to create a shadow table, which the duplicated entries are removed, for that table.
However I would like to use the shadow table as a subset of the original table - all modification will be made on the original table. And the shadow table provide a view for the original table. But unfortunately the shadow table doesn't work in this way.
How could I make the shadow table effectively get a subset of the original table? Thanks in advance.
distinct eliminates duplicates
create view my_view as
select distinct *
from t
select *
from my_view