问题标签 [system-tables]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
514 浏览

sql - PostgreSQL 中的“Information_schema.columns”表下未列出新创建的模式和表

我们新创建了几个表和模式(下面有表)。我们曾经通过查询Information_schema.columns表来获取表+列信息。但是在查询Information_schema.columns表时,新创建的表和模式没有显示出来。知道为什么吗?

我也做了一些研究,发现了一个表 - pg_tables,其中列出了新创建的表。但无法在此处获取列信息。它可以与任何其他子表连接以获取列信息吗?

谢谢!

0 投票
1 回答
113 浏览

database - 如何从 SAP HANA 数据库中获取 SPS 编号?

我目前正在编写一个脚本,它将元数据写入 SAP HANA 数据库的系统表。例如,我需要区分 HANA 数据库与版本 05 或更高版本的支持包堆栈。是否有任何系统表可以查询以获取使用的 SPS 版本?

谢谢你的帮助!安德烈

0 投票
1 回答
130 浏览

sql - SQL Anywhere query to dig schema structure

I'm trying to make a SQL query which does the following things:

  1. Select all tables in a schema
  2. Select all columns from the table
  3. Select the columns type (char, int, tinyint, etc)
  4. Select the columns index type or NULL (index type being FK or PK)
  5. If there is a foreign key index, select the primary table

This data should then be put in a XML file. Please note that this is in SQL Anywhere.

The code for the XML file is easily written, but I'm stuck at the query.

I currently have a query that can select all columns, their table and their data type.

which currently returns for example:

My desired result would be (for example):

I'm aware SQL Anywhere has system tables like: SYSFKEY, SYSIDX and SYSIDXCOL, but I have no idea how I'd implement this into my own query.

I've looked around on the internet, and I can find a lot of examples for other SQL services, but none for SQL Anywhere.

I could really use some assistance on this.

Update 1:
So I've figured out that the table SYSFKEY has some interesting columns.

  • foreign_table_id
  • foreign_index_id
  • primary_table_id

where primary_table_id seems to refer to the foreign table.

Also the table SYSIDX has the columns

  • table_id
  • index_id

I hope I can somehow connect all of this together

Update 2: So I've written a new query, which does suprisingly good actually. I thought I fixed it, until I ran into some oddities.

The query is currently this:

And this actually returns a lot of useful information! But something weird is happening.

There are multiple primary keys in a table. Perhaps thats just how the creators designed it to be, that every field together is the primary key, but it seems odd to me.

There are also multiple duplicates (multiple rows with columns that have been there before)

Example with multiple PK:

Example with multiple indexes:

Perhaps I should merge them together, but then still its odd there are multiple FK indexes on one column, right? Or perhaps the query gets stuck and just keeps dumping the same information in every result?

0 投票
2 回答
39 浏览

postgresql - 如何在 pg_class 中添加新列以进行对象创建日期转储

我想在 pg_class 中创建一个用于对象创建转储的列,但我无法添加。我正在使用以下查询: ALTER TABLE pg_catalog.pg_class ADD COLUMN relcreated TIMESTAMP;

当我运行此查询时,出现以下错误:错误:权限被拒绝:“pg_class”是系统目录 SQL 状态:42501 请建议任何对象创建时间转储的方法。这对于我的审计目的来说非常重要。

0 投票
0 回答
45 浏览

sql-server - 如何在此查询中替换 master..sp_values(用于几个月)?

我在master..spt_values支持的 SQL Server 中使用它,将其用作“月”数字支持(不要问我为什么;可能是旧查询即时写入):

不幸的是,现在我需要在另一个master..spt_values不支持的 SQL Server (Azure) 上迁移数据库:

如何在上面的查询中快速替换该表?本地表?有什么例子吗?

0 投票
1 回答
21 浏览

sql - 如何获取分配给表的特定字段/列的域的名称?

我使用来自 StackOverflow 的选择:如何使用 dbExpress 从 Firebird 获取表描述(字段和类型)以获取 Firebird 数据库的模式数据。

但是,此选择不显示分配给字段/列的域的名称。

有人也知道获取域名的语法吗?