Restore Postgresql database of table files

Is it possible to restore a Postgres database when only the table files are accessed in $PGDATA/base/? The system catalogs are empty.


Someone with sudo executed a rm -Rf under /var/lib. The random files were removed, but not the files in the database that interest me. Postgres did not start, even after manually restoring multiple files / directories. So I created a new $PGDATA and copied the files from the database, waiting for Postgres to read them automatically. Apparently, Postgres relies heavily on their system catalogs to maintain links between what is on the disk and what the user sees.

Ecommerce – Hide and Show a Table (B2B Ecommerce Product Detail Page)

I have a B2B product detail page.

We have a multi-vendor market, so like Amazon, we have multiple vendors for one product.

What are the options and the advantages or disadvantages of each option?

  • Show them in a modal
  • Show them on a separate page
  • show a table about them on the details page
  • Show them in one of our tabs (as description / product downloads)
  • Show them as a collapsible part of the page (which opens when you click view providers)
    • deploy a side panel (desktop) that on the mobile occupies the full width of the screen (see the Amazon website, for example)
  • Any other option

enter the image description here

information – How to create a clear and editable hierarchy table?

I was looking at some old hierarchical table threads (like this one), but nothing fit the requirements of my project, so I thought we could update the discussion!

In my app's hierarchy feature, users can add assets to any level, and they are accessible from any level below that. For example, anyone assigned to "Chicago" can access asset "NA0001" at the "Region – North America" ​​level, but someone assigned to "Indiana" cannot access asset "Illinois1".

I've put together this sketch, drawing inspiration from some methods I've seen for nested tables.

My main goals for this design are:

  1. Make it more obvious when an asset is assigned to a specific level
    (and therefore also assigned to everything below that level)
  2. View / navigate hierarchy more easily
  3. Easily assign an asset to a level

How well does this solution work?

  1. Understand which assets are assigned to a level, versus total
    amount of assets at that level?
  2. Does the "Asia" ("Active" as label) or "North America" ​​("Active" as text) format to indicate assets work better?
  3. Do the labels help indicate the level of hierarchy?
  4. What is general readability like?
  5. The next goal is to make it so that the user can easily add an asset at any level. Would the Edit drop-down menu work, or should there be an online "+ Add Asset" button at each asset level?

(This is a long question, please let me know if it should be divided into separate questions!)
Hierarchical table

Google sheet query, the number of columns in the table affects the speed

I have a great Google Sheets tab. It has around 1500 rows and the columns extend up to AR.

It was a very slow query until I got rid of some columns and reduced the columns to AB.

The selection speed is noticeably different, like 10x. Has anyone else noticed? There seems to be some threshold that once the table is above certain columns, the query The function slows down dramatically.

So my question is … how can I speed up the query if the number of columns is much more? I have another table where the columns extend to the column. DC and the consultation is painfully slow. How can I speed things up? Do I need to divide it into 2 tables? check some and use vlookup for the rest?

import – MySQL Workbench: I need to update values ​​in a table based on values ​​from a csv

Novice problem, but I have tried to create a new table and import the csv to that update, but have had problems with that, any guidance would be much appreciated.

I have a csv file that contains approximately 1500 entries, with a column "ID" and a column "Unit". I am trying to find the best way to update, in my mySQL workbench table, the "drive" of just the IDs in my csv file.

CSV file

id_inv  unit
1,      aaa
2,      aaa
3,      aaa
5,      aaa
10,     aaa

DB table

id_inv       unit     ... other columns
1            bbb
2            bbb
3            bbb
4            bbb
5            bbb
6            bbb
7            bbb
8            bbb
9            bbb
10           bbb

magento2 – How to insert data into custom column in sales_creditmemo_item table? magento 2

app design adminhtml Com override Magento_Sales templates order creditmemo create items.phtml

    getItem() ?>
    $order = $block->getOrder();
    $orderItem = $_item->getOrderItem();
    $orderItemData = $orderItemHelper->fetchOrderItemData($order, $orderItem);

    getColumnHtml($_item, 'name') ?>

So here I have created a checkbox that stores the order article number as value in / admin / sales / order_creditmemo / new /(Create new credit note). So every time this checkbox is checked and Refund button is clicked, you must save the value of the checkbox in article number column inside sales_creditmemo_item table. It would be really helpful for me to keep learning new magento 2 concepts if anyone can provide any suggestion or advice. Thanks and regards

design: a table or several tables, how to represent the multiple relationship between two entities?

I am developing a blog system, between the User entity and the Publish entity, there can be multiple relationships, such as:

  • commentary
  • vote in favor
  • user upload images

I have decided to use the association table to represent these relationships. Although these are totally different relationships in the real world, but they seem to have many similar fields, such as created_time, modified_time, not to mention the two foreign keys (also primary key) (userid, postid).

Now it seems to me that I have two ways:

  1. use a table for a relationship. For example, to comment, I have comment_association_tableto vote I have upvote_association_table.
  2. use a table to represent all of these relationships, use a separate discriminator column to distinguish between them. For example, I have a association_tableand a column type, to comment, the type the value is 1, to vote in favor, the type the value is 2.

So how should I use it, and what about pros and cons? Or is there some other way?

Delete export record from which table?

for some reason i have to delete this record from the table (it is stuck, cannot be downloaded or deleted)
Does anyone know that this record belongs to which table? so i can remove it by SQL query
Thank you

mysql – Add constraint to an existing table column

I have a table that has no restrictions on them like this

   Id int NOT NULL,
   Type varchar(50),

insert into SomeTable values (12,'Exchange-Student');

Now I know what I can do alter inside add constraint and so check if the type is my desired value.
I just don't know how to implement it correctly.

For example, let's say I want it to be restricted to 3 types 'Exchange-Studen', 'Independent student' Y 'program Student'

How would you implement that?

database design: is it correct to have status or summary columns in the main table or should I choose another procedure?

My main table is the "Jobs" table, and there is a child table that records Job's actions called "JobActions" as follows:

Jobs (Job identification, JobType, CurrentStage, AssignedTo)

JobActions (JobActionId, Job identification, CreateDate, ActionType, FromUserId, ToUserId, Message, Detail)

In my grid on the webpage I list the grid columns as follows:

JobId, CreateDate, CurrentStage, AssignedTo, LastActionType, LastActionDate, …

In the grid to calculate the columns below, I use joins to child table (very slow when there are lots of users and lots of data)

CreateDate ==> First (or minimum) JobActions & # 39; CreateDate,

LastActionType ==> ActionType of Last JobActions,

LastActionDate ==> Last (or maximum) JobActions & # 39; CreateDate

I have around five columns like this that need to join either the JobActions or Another tables, so I decided to change the Job table as shown below:

Jobs (Job identification, JobType, CurrentStage, AssignedTo, CreateDate, LastActionType, LastActionDate)

the last three columns are always updated every time a jobaction is added to JobActions.

  • Question 1: Is this a correct version (am I denormalizing my tables?)
  • Question 2: Should I use the trigger for this type of work or should I update from my code?
  • Question 3: Is this the best practice? Is there a better solution for this type of problem?