(
state: &SharedState,
identity: &AuthenticatedIdentity,
sql: &str,
upper: &str,
parts: &[&str],
database_id: crate::types::DatabaseId,
)
| 7 | use crate::control::state::SharedState; |
| 8 | |
| 9 | pub(super) async fn dispatch( |
| 10 | state: &SharedState, |
| 11 | identity: &AuthenticatedIdentity, |
| 12 | sql: &str, |
| 13 | upper: &str, |
| 14 | parts: &[&str], |
| 15 | database_id: crate::types::DatabaseId, |
| 16 | ) -> Option<PgWireResult<Vec<Response>>> { |
| 17 | // Vector index lifecycle: SHOW VECTOR INDEX, ALTER VECTOR INDEX. |
| 18 | if upper.starts_with("SHOW VECTOR INDEX ") { |
| 19 | return Some( |
| 20 | super::super::maintenance::handle_show_vector_index(state, identity, sql).await, |
| 21 | ); |
| 22 | } |
| 23 | if upper.starts_with("ALTER VECTOR INDEX ") && upper.contains(" SEAL") { |
| 24 | return Some( |
| 25 | super::super::maintenance::handle_alter_vector_index_seal(state, identity, sql).await, |
| 26 | ); |
| 27 | } |
| 28 | if upper.starts_with("ALTER VECTOR INDEX ") && upper.contains(" COMPACT") { |
| 29 | return Some( |
| 30 | super::super::maintenance::handle_alter_vector_index_compact(state, identity, sql) |
| 31 | .await, |
| 32 | ); |
| 33 | } |
| 34 | if upper.starts_with("ALTER VECTOR INDEX ") && upper.contains(" SET ") { |
| 35 | return Some( |
| 36 | super::super::maintenance::handle_alter_vector_index_set(state, identity, sql).await, |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | // Vector model metadata: ALTER COLLECTION ... SET VECTOR METADATA ON ... |
| 41 | if upper.starts_with("ALTER COLLECTION ") && upper.contains("SET VECTOR METADATA ON") { |
| 42 | return Some(super::super::collection::handle_set_vector_metadata( |
| 43 | state, identity, sql, |
| 44 | )); |
| 45 | } |
| 46 | |
| 47 | // SHOW VECTOR MODELS — catalog view. |
| 48 | if upper.starts_with("SHOW VECTOR MODELS") || upper == "SHOW VECTOR MODELS" { |
| 49 | return Some(super::super::collection::handle_show_vector_models( |
| 50 | state, identity, |
| 51 | )); |
| 52 | } |
| 53 | |
| 54 | // SELECT VECTOR_METADATA('collection', 'column') — inline query. |
| 55 | if upper.starts_with("SELECT VECTOR_METADATA(") || upper.starts_with("SELECT VECTOR_METADATA (") |
| 56 | { |
| 57 | let inner = sql |
| 58 | .find('(') |
| 59 | .and_then(|start| sql.rfind(')').map(|end| &sql[start + 1..end])); |
| 60 | if let Some(args_str) = inner { |
| 61 | let args: Vec<&str> = args_str |
| 62 | .split(',') |
| 63 | .map(|s| s.trim().trim_matches('\'').trim_matches('"')) |
| 64 | .collect(); |
| 65 | if args.len() >= 2 && !args[0].is_empty() && !args[1].is_empty() { |
| 66 | return Some(super::super::collection::handle_vector_metadata_query( |
nothing calls this directly
no test coverage detected